3v4l.org

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

preferences:
33.99 ms | 402 KiB | 5 Q