@hal.littel use foreach loop to over array to find if a number is evenly divisible by 2 with no remainder, then it is even, here is PHP implementation:
1 2 3 4 5 6 7 8 9 10 11 |
<?php $arr = [1, 2, 3, 4, 5, 6, 7, 8]; // Loop over array foreach ($arr as $number) { // Check if the number is even or not. if ($number & 2 === 0) { echo $number . PHP_EOL; } } |