Are you first timer at lazacode.org? Why not join us and start exchange your knowledge with everyone. Register today!

PHP 5 - Syntax

0 votes
12 views
added Mar 15 in PHP by Callum Corporal (1,350 points)
edited Mar 21 by LC Marshal

Comment multiple PHP lines

<?php /***?>
<div class="input checkbox m-reset">
  <input type="checkbox" id="saved-<?php echo $item['nid']; ?>">
  <label for="saved-<?php echo $item['nid']; ?>" class="p-reset"></label>
</div> 
/****/ ?>

2 examples

0 votes
responded Apr 24 by LC Marshal First Warrant Officer (8,170 points)

PHP statements end with a semicolon (;).

<?php
echo "Hello Lazacode!";
?>
0 votes
responded Apr 24 by LC Marshal First Warrant Officer (8,170 points)

Case-sensitive are not applicable to all PHP keywords (i.e if, else, while, echo, etc.), classes, functions, and user-defined functions.

<?php
ECHO "Hello Lazacode!<br>";
echo "Hello Lazacode!<br>";
EcHo "Hello Lazacode!<br>";
?>

 

However; all variable names are case-sensitive. The following example of variables treated as 3 different variables.

<?php
$color = "brown";
$COLOR = "black";
$coLOR = "white";
echo "My hair color is " . $color . "<br>";
echo "My motorbike color is " . $COLOR . "<br>";
echo "My house color is " . $coLOR . "<br>";
?>
lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...