Author: codertutor_3o6d0o

PHP While

PHP While While syntax while (expression is true) { execute statement } While example <html> <body> <?php $x = 1; while ($x <= 3) { echo "<br />"; echo "x = ", $x++; } ?> </body> </html> Result x = 1...

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 />",...