pull-icon
logo-mobile

Guidelines and Rules for Syntax

Home/Forums/Guidelines and Rules for Syntax

EmmaS

yesterday

Comments in php
<?php
# Single line comment
// Single line comment
/* 
Multiline
Comment
*/
?>


Whitespace Inside Its Tags
<?php
$name="James"; // Good and minified 
$name = "James"; // Good but not as slim byte-wise, easier on the eyes
?>


Variable Naming
<?php
$var1 = "value"; // GOOD
$user_1 = "value"; // GOOD
$1var = "value"; // Throws Error
$|*% = "value"; // Throws Error
?>


Semicolon Terminates Lines
<?php
$person_1 = "Amy"; // GOOD
$person_1 = "Amy" // BAD
$person_1 = "Amy"
; // It will work but not the best way
?>


Case Sensitive php
<?php
$var = "car";
$Var = "faster";
echo "The ".$var." goes ".$Var." when you put your foot down.";
// The "car goes faster when you put your foot down.
?>


String Concatenation
<?php
$car_1 = "car";
$car_2 = "fuel";
echo "The ".$car_1." stops when you run out of ".$car_2;
echo 'The '.$car_2.' will help the  '.$car_2." work again.';
?>


Escaping Quote Marks
<?php
$str1 = "I watched \"Fallout Season 1\" and it was great";
$str2 = 'I watched \'Fallout Season 1\' and it was brilliant.';
$str3 = "I watched 'Wednesday S1' and it was fantastic.";
$str4 = 'I watched "Wednesday S2" and it was awesome.';
echo $str1; // I watched "Fallout Season 1" and it was great.
echo $str2; // I watched 'Fallout Season 1' and it was brilliant.
echo $str3; // I watched 'Wednesday S1' and it was fantastic.
echo $str4; // I watched "Wednesday S2" and it was awesome.
?>

Leave a Comment

You must be logged in to post a reply.


BellOnline provides fast, reliable UK hosting designed for modern radio and web projects. Optimised servers, strong security, and excellent uptime ensure your station runs smoothly.
MixStream delivers broadcast-grade radio streaming with outstanding stability, crystal-clear audio, and powerful performance even during peak listener hours. Perfect for hobby stations and professional broadcasters alike.


Your secure download link has been emailed to:

Goto BellOnline Now!