Source Code:
(back to article)
<?php // Example 1 $myNumber = 5; if ($myNumber == 4) { echo "Number is 4"; } elseif ($myNumber == 5) { echo "Number is 5" . PHP_EOL; } else { echo "Number is not 4 or 5"; } // Output: Number is 5 // Example 2 $myString = "hello"; if ($myString == "hi") { echo "Greeting is hi"; } elseif ($myString == "hello") { echo "Greeting is hello" . PHP_EOL; } else { echo "Greeting is not recognized"; } // Output: Greeting is hello
Result:
Report an issue