3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array('potato', 'salad', 'salad_rel'); $start_time = microtime(TRUE); for ($i = 0; $i < 100000; $i++){ foreach ($test as $string){ substr($string, -4) == '_rel'; } } $end_time = microtime(TRUE); echo $end_time - $start_time . PHP_EOL; $start_time = microtime(TRUE); for ($i = 0; $i < 100000; $i++){ foreach ($test as $string){ preg_match('#.{1,}_rel$#', $string); } } $end_time = microtime(TRUE); echo $end_time - $start_time . PHP_EOL;

preferences:
31.2 ms | 402 KiB | 5 Q