Category: PHP

PHP Switch

PHP Switch Switch syntax switch (x) { case x1: if x=x1 then execute statement break; case x2: if x=x2 then execute statement break; case x3: if x=x3 then execute statement break; … default: statement to be executed if x is not...

PHP IF – Else – Elseif

PHP IF – Else – Elseif Syntax if (condition) { if condition is true then execute statement } if (condition) { if condition is true then execute statement } else { if condition is false then execute statement } if (A)...

PHP Strings

PHP Strings Strings example <html> <body> <?php echo strlen("PHP beginner course!"); echo "<br />"; echo str_word_count("Learn about PHP strings."); echo "<br />"; echo strtolower("PHP online course!"); echo "<br />"; echo str_replace("beginner", "advanced", "PHP beginner!"); ?> </body> </html> Result 20 4 php...

PHP Constants

PHP Constants A constant is case-sensitive by default. By convention, constant identifiers are always uppercase. Constants syntax define(name, value, case-insensitive) or define(name, value) Constants example <html> <body> <?php define("C1", "PHP beginner course<br />", true); echo c1; define("C2", "PHP advanced course<br />",...

PHP Operators

PHP Operators The Arithmatic Operators: Example Name Result $n + $z Addition Sum of $n and $z. $n – $z Subtraction Difference of $n and $z. $n * $z Multiplication Product of $n and $z. $n / $z Division Quotient of...