3v4l.org

run code in 500+ PHP versions simultaneously
<?php $test = array( 30.04, 0.00, 30.04, 0.00, 47.00, 17.03, 5.02, 25.08, 2.06, 32.06, 37.00, 7.07, ); $output = array(); foreach ($test as $key => $value) { // To make sure this will only be executed every second item if ($key % 2 !== 0) { continue; } $next = ''; if (!isset($test[$key+1])) { break; } else { $next = $test[$key+1]; } $output[$key] = $value . ' is ' . ($value < $next ? "lower" : ($value > $next ? 'higher' : 'equal')) . ' than ' . $next; } echo '<pre>'; print_r($output);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
<pre>Array ( [0] => 30.04 is higher than 0 [2] => 30.04 is higher than 0 [4] => 47 is higher than 17.03 [6] => 5.02 is lower than 25.08 [8] => 2.06 is lower than 32.06 [10] => 37 is higher than 7.07 )

preferences:
100.5 ms | 1996 KiB | 4 Q