Source Code:
(back to article)
<?php // Example 1 $myNumber = 1; do { echo $myNumber . PHP_EOL; $myNumber++; } while ($myNumber <= 5); // Output: 1 2 3 4 5 // Example 2 $myArray = ["apple", "banana", "cherry", "date"]; $index = 0; do { echo $myArray[$index] . PHP_EOL; $index++; } while ($index < count($myArray)); // Output: apple banana cherry date
Result:
Report an issue