Basic php script how its is works with Html,how Embbed php code in Html.how basically variables works,echo, and print variables.
CODE
A PHP script starts with :
<?php //Php Start // PHP code goes here //Php End ?>
“<?php” Starting of php code
“?>” Ending of php
<?php echo "Hello World !"; ?>
OUTPUT:
[insert_php]
echo”Hello World !”;
[/insert_php]
Comments in PHP
<!DOCTYPE html> <html> <body> <?php // This is a single-line comment # This is also a single-line comment /* Multiple-lines comment block that Expand over multiple lines */ // You can also use comments to leave out parts of a code line $x = 100 /* + 60 */ + 6; echo $x; ?> </body> </html>
OUTPUT:
[insert_php]
$x = 100 /* + 60 */ + 6;
echo $x;
[/insert_php]
<?php $x = 12; // Int Number $y = 0.4; // Float $str = "Total Result"; // String echo $x+$y;//Total echo "<br/>";//break echo $x+$y.$str; // Concatenation echo "<br/>";//break $col = "Red"; echo "<br/>";//break echo $col; ?>
[insert_php]
$x = 12; // Int Number
$y = 0.4; // Float
$str = ” Total Result”; // String
echo $x+$y;//Total
echo ”
“;
echo $x+$y.$str;
echo ”
“;
$col = “Red”;
echo $col;
[/insert_php]
(Visited 95 times, 1 visits today)
Written by: