A sample PHP addition program
<?php$a=10;
$b=5;
$c=$a+$b;
echo $c;
?>
output will be 15
Explanation:
line 1: opening of PHP script
line 2: $a=10; PHP uses $ sign to declare variables and does not require Data type to be declared.
suppose:
if you declare $a=10; php understands that this of type integer
if you declare $a=10.5; php understands that this of type floating value
if you declare $a='This is PHP tutorial'; php understands that this of type string and so on...
and of course semicolon(;) is required to terminated the statement.
line 3:$b=5; same as above explanation.
line 4: is an expression to add two values and take that value in $c variable
line 5: outputs the Addition by using echo statement followed by $c; variable.
line 6: ends the PHP script.
how can i read command line argument??????
ReplyDelete