Source Code:
(back to article)
<?php // Input Array $myArray = [1, 2, 3, 4]; $index = 2; $default = "No Value Found"; if (isset($myArray[$index])) { echo "Using If-Else: " . $myArray[$index] . "\n"; } else { echo "Using If-Else: " . $default . "\n"; }
Result:
Report an issue