3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_values_between($the_string, $starts_with, $ends_with) { if(strpos($the_string , $starts_with)===false) return array(); $the_string = substr($the_string,strpos($the_string , $starts_with)); //echo $the_string; $temp = array_filter(explode($starts_with, $the_string)); $result_array = array(); $inc = 0; foreach($temp as $a_start_match) { if (strlen($ends_with) <= strlen($a_start_match)) { $a_start_match = substr($a_start_match,0,strpos($a_start_match , $ends_with)); echo substr($a_start_match, -strlen($ends_with)." against ".$ends_with."\n"; if(substr($a_start_match, -strlen($ends_with)) === $ends_with) { echo $a_start_match."\n"; $result_array[$inc]=$a_start_match; $inc++; } } } return $result_array; } $the_string = "some string here string_1ABCDEFGHstring2 some string here string_1IJKLMNOPQRSTstring2 some string here string_1UVWstring2XYZ"; $start = "string_1"; $end = "string2"; $result = get_values_between($the_string,$start,$end); //print_r($result);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.160.0300.05912.38
5.4.150.0140.04512.38
5.4.140.0160.04212.07
5.4.130.0160.04212.05
5.4.120.0160.04212.02
5.4.110.0210.06712.01
5.4.100.0150.04312.01
5.4.90.0150.04512.01
5.4.80.0160.04512.01
5.4.70.0160.05512.01
5.4.60.0200.06812.01
5.4.50.0150.04212.01
5.4.40.0160.04012.00
5.4.30.0160.04311.99
5.4.20.0150.04111.99
5.4.10.0120.04411.99
5.4.00.0230.06411.48
5.3.260.0100.05012.72
5.3.250.0080.03512.72
5.3.240.0140.04712.72
5.3.230.0250.06412.71
5.3.220.0160.04312.68
5.3.210.0140.04512.68
5.3.200.0160.04412.68
5.3.190.0180.04312.68
5.3.180.0180.05612.67
5.3.170.0210.06812.67
5.3.160.0150.04312.67
5.3.150.0140.04512.67
5.3.140.0180.04212.66
5.3.130.0180.04312.66
5.3.120.0160.04312.66
5.3.110.0130.04612.66
5.3.100.0230.06712.12
5.3.90.0180.04112.09
5.3.80.0160.04512.08
5.3.70.0180.04212.08
5.3.60.0150.04312.06
5.3.50.0170.07312.01
5.3.40.0150.04312.01
5.3.30.0200.05211.98
5.3.20.0140.04311.77
5.3.10.0110.04311.72
5.3.00.0190.04111.70

preferences:
157.7 ms | 1394 KiB | 7 Q