PHP First Program
Today we start the first program in PHP before starting we should know some points.
- After installing xampp, we save all our codes file (myfirstpage.php file) in the “C:\xampp\htdocs” folder.
So now Start the xampp server and Start Apache and MySQL, then start notepad++ and select language from the menu bar and select PHP.
In the XAMPP I captured the screenshot after clicking Start.

The first program.

- To execute the code we access our computer as a web server and domain name is localhost or access by local IP 127.0.0.1.
- The htdocs is the root folder of our local web server. To execute the file we enter the following URL in our browser: localhost/myfirstpage.php.

- Then the program will execute.
Do you have a a question what is echo? Yes!
The echo is the function that prints the data on the screen. The print() is the old version of echo and it is not used so much used in the coding.
PHP variables
Understanding variables is very simple in php . There are some rules about PHP variables.
- First character must start with dollar sign ($).
Example: $count = 0;
- At least one character should be in the variable except $.
- We can use underscore in the variable name.
Example: $Adhaar_number ;
- Spaces and special character other than (_) and ($) are not allowed.
Some rules that are least important but good for coding skills.
- Always the variables name are in lowercase.
- To separate multiword use (_) sign.
Now the time is to see an example of Variable.

You can print the variables using the echo function.
So there are many things you can understand by only seeing this example. I am now explaining one by one:
- The is no data type written before variable language unlike other programming languages like C, C++, Java, etc.
- We only simply write dollar then variable name.
- If we give the value to a variable a int then the php act it as an int. Same in float, long, etc numerical variables.
- But when the value is in the inverted commas, php act it as a String. For example, $value=’100’,name =”RAdha”, $value =”100.876”, &value=’20.876’ these act as a string.
- If we talk about the Boolean, I thinl you know about that.

Ankit BansalPosted Sep 28, 2015, 12:52 AM
nice one..thanks ..
Harshad PansuriyaPosted Sep 28, 2015, 12:40 AM
Nice One
Sandeep KumarPosted Sep 28, 2015, 12:32 AM
Good one :) and complete php tutorial by describingit completely
Raja TPosted Sep 27, 2015, 3:58 AM
Nice,Thanks for sharing
P PPosted Sep 27, 2015, 2:18 AM
yup.............@Pankaj Kumar Choudhary
RakeshPosted Sep 27, 2015, 12:41 AM
Good start
Pankaj Kumar ChoudharyPosted Sep 26, 2015, 7:03 PM
Nice Start... Hope it will be Series of Article.........
P PPosted Sep 26, 2015, 4:38 PM
there are some typing mistakes in it . may be i forget to do CTRL + S .when i had make it correct...
Gopi ChandPosted Sep 26, 2015, 2:53 PM
Good one Pradeep..keep going :)