Lest continue our lesson so you can quickly learn php 7
variable name start with "$"( dollar sign) and note that first corrector is should not number
For example
before declare variable you take care that PHP is case sensitive
php script is always written between that line and file extension is .php <?php ?>
If you print hello world ,Lets write simple addition program and run it
<?php
echo "hello world";
?>
Now save it to c:/wamp/www/demo (crate new folder) / and save it as index.php , index.php file is magic file which not display in url mostly this file use in home page
Now go to browser and type
php variable
For example
- $2name that is wrong
Right example is
- $name
php automatic detect data types of variable
for example integer
$number= 20;
for example float
$average= 20.4;
Note that at last you need to add ;( semicolon )
Lets add to value
<?php
$number1 = 10;
$number2 = 10;
$answer = $number1 + $number2;
echo "anser is - " . $answer;
?>
Note : If you want to add two value then you need . operator which combine to or more line
ok friend can practice of this chapter , in next lesson we will new things, we will learn in short time thank you
No comments:
Post a Comment
your suggestion are welcome by me