Monday, 9 May 2011

Learn PHP online:PHP Day-7

Comments in PHP Code



Comments in PHP Code

Comments are used to stop the execution of a line or set of lines script.
“//,#” are comes under single line comments.
“/*,*/” are comes under multiple lines comments.
Ex:
<?php
echo "Hello World!"; // This will print out Hello World!
echo "<br />Psst...You can't see my PHP comments!"; // echo "nothing";
// echo "My name is Humperdinkle!";
# echo "I don't do anything either";
?>
Isset: This function is used to check the variable is set with any value or not.
Ex:
<?php
$x=100;
$sno;
echo isset($x);
echo isset($no);
?>
Unset: This function unsets a variable value.
Ex:
<?php
$x=100;
unset($x);
?>


Ini_get: By using this function we can get the configuration directive values. And Also we can change the configuration directive values.
<?php
echo ini_get("precision");
ini_set("precision",16);
echo ini_get("precision");
?>
Note: In php dot(.) is an operator used to concatenate two values.
Ex:
                   <?php
                       $x=100;
                       $y=200;
                       echo $x.$y;
                    ?>

Note: In PHP “@” is an operator used to hide the errors.
Ex:
<?php
@fun1();
echo "next";
?>

No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...