Source Code:
(back to article)
<?php // Example 1 $myVariable = ""; if (empty($myVariable)) { echo "Variable is empty" . PHP_EOL; } else { echo "Variable is not empty"; } // Output: Variable is empty // Example 2 $myArray = []; if (empty($myArray)) { echo "Array is empty"; } else { echo "Array is not empty"; } // Output: Array is empty
Result:
Report an issue