3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 200000; $i++) { $a[] = array( 'name' => 'John', 'city' => 'New York', 'age' => $i % 200 == 0 ? 21 : 28 ); } $time = microtime(true); $filtered = array(); foreach ($a as $item) { if ($item['age'] == 21) $filtered[] = $item; } $time = microtime(true) - $time; echo 'explicit foreach ' . number_format($time, 3) . ' seconds and returned ' . count($filtered) . " entries\n";

preferences:
39.68 ms | 402 KiB | 5 Q