3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mysql_result[0]['id']="1"; $mysql_result[1]['id']="2"; $mysql_result[2]['id']="3"; $mysql_result[0]['address']="www.example.com/page1"; $mysql_result[1]['address']="www.example.com/page2"; $mysql_result[2]['address']="www.example.com/page3"; $mysql_result[0]['title']="Page 1"; $mysql_result[1]['title']="Page 2"; $mysql_result[2]['title']="Page 3"; $mysql_result[0]['content']="The quick dog jumps over the lazy dog."; $mysql_result[1]['content']="The best thing about morning is breakfast."; $mysql_result[2]['content']="Hotdogs are great ballpark food."; $mysql_result[0]['image']="image1.jpg"; $mysql_result[1]['image']="image2.jpg"; $mysql_result[2]['image']="image3.jpg"; $query="dog"; $chars_to_show_before = 10; $chars_to_show_after = 10; foreach($mysql_result as $results) { $content = str_replace($query,"my_un1qu3_r3pl4c3m3nt_".$query,$results['content']); $occurences = explode("my_un1qu3_r3pl4c3m3nt_",$content); $position_in_original_content = 0; foreach($occurences as $an_occurence) { if (strpos($an_occurence,$query) !== false) { $content=$an_occurence; //echo "\npos $position_in_original_content\n"; //echo "\n\nworking on \n".substr($results['content'],$position_in_original_content-$chars_to_show_before,strlen(strlen($query))+$chars_to_show_after+$chars_to_show_before)."\n\n"; echo '<li class="media"> <a class="pull-left" href="'.$results['address'].'"> <img class="media-object thumbnail" src="'.$results['image'].'" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="'.$results['address'].'">'.$results['title'].'</a></h4> <p>...'.str_replace($query,'<strong>'.$query.'</strong>', substr($results['content'],min(0,($position_in_original_content-$chars_to_show_before)),strlen(strlen($query))+$chars_to_show_after+$chars_to_show_before)).'...</p> </div>'.($position_in_original_content-0).' and '.(strlen($an_occurence)+0).' </li>'; } $position_in_original_content = $position_in_original_content + strlen($an_occurence); } }

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)
8.3.60.0180.00916.50
8.3.50.0110.00716.48
8.3.40.0130.00318.97
8.3.30.0150.00418.67
8.3.20.0080.00018.95
8.3.10.0030.00520.57
8.3.00.0000.00919.22
8.2.180.0090.00916.63
8.2.170.0090.00922.96
8.2.160.0070.00721.05
8.2.150.0030.00724.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00419.95
8.2.110.0030.00619.24
8.2.100.0040.00717.91
8.2.90.0040.00419.01
8.2.80.0000.00917.97
8.2.70.0030.00617.63
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0000.00818.34
8.2.30.0030.00518.21
8.2.20.0050.00317.82
8.2.10.0040.00417.66
8.2.00.0070.00417.78
8.1.280.0100.00725.92
8.1.270.0000.00724.66
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0050.00522.19
8.1.230.0090.00319.04
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0080.00017.35
8.1.180.0000.00918.10
8.1.170.0050.00318.84
8.1.160.0040.00418.93
8.1.150.0000.00718.67
8.1.140.0000.01217.59
8.1.130.0000.00717.93
8.1.120.0030.00317.36
8.1.110.0070.00017.38
8.1.100.0050.00317.39
8.1.90.0030.00517.42
8.1.80.0040.00417.52
8.1.70.0040.00417.47
8.1.60.0040.00417.64
8.1.50.0000.00717.39
8.1.40.0000.00817.50
8.1.30.0040.00417.72
8.1.20.0050.00317.70
8.1.10.0000.00717.65
8.1.00.0000.00817.54
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.48
8.0.270.0050.00517.23
8.0.260.0030.00316.86
8.0.250.0000.00717.00
8.0.240.0040.00716.96
8.0.230.0030.00317.03
8.0.220.0030.00316.98
8.0.210.0000.00716.84
8.0.200.0000.00716.95
8.0.190.0040.00417.02
8.0.180.0050.00216.95
8.0.170.0060.00316.93
8.0.160.0040.00416.97
8.0.150.0080.00017.00
8.0.140.0080.00416.88
8.0.130.0030.00313.45
8.0.120.0070.00016.84
8.0.110.0050.00216.95
8.0.100.0000.00716.96
8.0.90.0020.00516.73
8.0.80.0050.00916.86
8.0.70.0040.00416.82
8.0.60.0070.00016.82
8.0.50.0080.00016.92
8.0.30.0050.01517.20
8.0.20.0140.00617.05
8.0.10.0050.00317.02
8.0.00.0120.00616.67
7.4.330.0050.00013.02
7.4.320.0060.00016.65
7.4.300.0000.00716.46
7.4.290.0030.00316.45
7.4.280.0050.00316.58
7.4.270.0030.00616.69
7.4.260.0030.00313.39
7.4.250.0040.00416.54
7.4.240.0000.00716.50
7.4.230.0030.00316.52
7.4.220.0060.01216.52
7.4.210.0080.00816.60
7.4.200.0000.00716.44
7.4.190.0000.00716.60
7.4.160.0030.01316.40
7.4.150.0030.01416.51
7.4.140.0130.00616.69
7.4.130.0090.00816.53
7.4.120.0110.00516.63
7.4.110.0110.01116.44
7.4.100.0120.00616.36
7.4.90.0130.00516.60
7.4.80.0120.00916.70
7.4.70.0060.01116.40
7.4.60.0090.01316.42
7.4.50.0000.00416.32
7.4.40.0030.01416.70
7.4.30.0070.01016.74
7.4.00.0100.00714.98
7.3.330.0060.00013.13
7.3.320.0050.00013.21
7.3.310.0030.00316.24
7.3.300.0000.00716.31
7.3.290.0110.00716.34
7.3.280.0100.01016.38
7.3.270.0100.00716.56
7.3.260.0090.01116.65
7.3.250.0050.01216.52
7.3.240.0030.01316.41
7.3.230.0070.01016.41
7.3.210.0030.01316.72
7.3.200.0100.01019.39
7.3.190.0120.00616.38
7.3.180.0140.00316.26
7.3.170.0120.00516.63
7.3.160.0120.00416.65
7.3.120.0040.01115.10
7.3.10.0030.01016.63
7.3.00.0140.00016.41
7.2.330.0060.01516.76
7.2.320.0090.01516.43
7.2.310.0060.01316.81
7.2.300.0060.00916.75
7.2.290.0130.00316.57
7.2.130.0090.00616.96
7.2.120.0030.01317.00
7.2.110.0040.01116.82
7.2.100.0100.00516.78
7.2.90.0130.00717.01
7.2.80.0100.00517.02
7.2.70.0120.00417.20
7.2.60.0100.00316.97
7.2.50.0000.01216.99
7.2.40.0000.00917.05
7.2.30.0050.00816.86
7.2.20.0040.00917.09
7.2.10.0130.00016.94
7.2.00.0130.00518.37
7.1.250.0070.00215.53
7.1.100.0060.00617.99
7.1.70.0100.00616.93
7.1.60.0030.02019.40
7.1.50.0190.00316.82
7.1.00.0100.07722.28
7.0.200.0030.00616.72
7.0.140.0100.07022.09
7.0.120.0070.06721.96
7.0.60.0070.08720.10
7.0.50.0100.05017.90
7.0.40.0170.07720.40
7.0.30.0230.07020.21
7.0.20.0270.07720.34
7.0.10.0100.06719.99
7.0.00.0070.09020.16
5.6.280.0030.07321.05
5.6.210.0030.04020.73
5.6.200.0130.07318.13
5.6.190.0000.04720.27
5.6.180.0230.05720.64
5.6.170.0270.05320.33
5.6.160.0200.07320.66
5.6.150.0130.05718.15
5.6.140.0030.08718.11
5.6.130.0030.09018.16
5.6.120.0170.05320.91
5.6.110.0100.08320.99
5.6.100.0230.06320.99
5.6.90.0000.05320.87
5.6.80.0070.07720.41
5.5.350.0330.06020.34
5.5.340.0130.04717.99
5.5.330.0000.07720.40
5.5.320.0130.04320.50
5.5.310.0300.07020.23
5.5.300.0000.04718.02
5.5.290.0070.07717.93
5.5.280.0130.07020.78
5.5.270.0070.03720.82
5.5.260.0130.08320.75
5.5.250.0130.05720.70
5.5.240.0030.06320.29
5.4.450.0000.04319.40
5.4.440.0100.07719.45
5.4.430.0030.05019.44
5.4.420.0100.07019.50
5.4.410.0030.07719.38
5.4.400.0030.04318.79
5.4.390.0170.03319.18
5.4.380.0000.04319.11
5.4.370.0070.03719.09
5.4.360.0130.03719.18
5.4.350.0070.03319.20
5.4.340.0070.03719.08
5.4.320.0030.03718.93
5.4.310.0070.07318.96
5.4.300.0130.06019.14
5.4.290.0000.04719.13
5.4.280.0030.06719.07
5.4.270.0000.08018.78
5.4.260.0030.07718.91
5.4.250.0100.07318.78
5.4.240.0000.05019.07
5.4.230.0130.07719.07
5.4.220.0070.03319.16
5.4.210.0070.04018.87
5.4.200.0000.04719.13
5.4.190.0070.03318.91
5.4.180.0000.06718.78
5.4.170.0070.07318.91
5.4.160.0030.04719.19
5.4.150.0030.04319.12
5.4.140.0070.03716.21
5.4.130.0070.04316.26
5.4.120.0030.03716.32
5.4.110.0000.05016.29
5.4.100.0070.04716.41
5.4.90.0030.04016.27
5.4.80.0070.04016.34
5.4.70.0030.05316.29
5.4.60.0030.03316.60
5.4.50.0070.04716.38
5.4.40.0100.04016.14
5.4.30.0030.07316.31
5.4.20.0030.06316.20
5.4.10.0030.03716.57
5.4.00.0030.04015.80
5.3.290.0000.07314.71
5.3.280.0030.07714.59
5.3.270.0030.05014.57
5.3.260.0070.05314.56
5.3.250.0030.05714.55
5.3.240.0100.07314.64
5.3.230.0000.04014.59
5.3.220.0030.04014.55
5.3.210.0070.03314.52
5.3.200.0100.07014.38
5.3.190.0070.07314.54
5.3.180.0070.04014.38
5.3.170.0070.04014.55
5.3.160.0030.03714.51
5.3.150.0000.06014.46
5.3.140.0030.08014.59
5.3.130.0100.07314.51
5.3.120.0030.07014.36
5.3.110.0070.03314.52
5.3.100.0030.03714.02
5.3.90.0000.04013.98
5.3.80.0070.04713.86
5.3.70.0100.03013.99
5.3.60.0000.04313.98
5.3.50.0030.05713.90
5.3.40.0000.07313.89
5.3.30.0000.04013.72
5.3.20.0100.05013.55
5.3.10.0000.04313.61
5.3.00.0100.04713.64
5.2.170.0000.03011.07
5.2.160.0030.03011.14
5.2.150.0070.03311.33
5.2.140.0000.03011.10
5.2.130.0000.03011.12
5.2.120.0030.06311.01
5.2.110.0030.02711.02
5.2.100.0000.03310.95
5.2.90.0030.03010.95
5.2.80.0000.03311.20
5.2.70.0030.04711.11
5.2.60.0030.05011.06
5.2.50.0030.03710.94
5.2.40.0070.05711.00
5.2.30.0000.04711.15
5.2.20.0030.03010.89
5.2.10.0100.04310.95
5.2.00.0100.05010.78
5.1.60.0100.02310.15
5.1.50.0030.05710.16
5.1.40.0030.0309.98
5.1.30.0070.02710.49
5.1.20.0100.03710.42
5.1.10.0030.06010.05
5.1.00.0000.06710.11
5.0.50.0100.0408.63
5.0.40.0000.0478.43
5.0.30.0000.0538.24
5.0.20.0030.0178.24
5.0.10.0000.0278.16
5.0.00.0070.0608.34
4.4.90.0030.0337.84
4.4.80.0030.0137.84
4.4.70.0000.0177.84
4.4.60.0000.0177.84
4.4.50.0030.0137.84
4.4.40.0000.0237.84
4.4.30.0000.0277.84
4.4.20.0070.0337.84
4.4.10.0030.0377.84
4.4.00.0000.0277.84
4.3.110.0000.0177.84
4.3.100.0000.0177.84
4.3.90.0030.0237.84
4.3.80.0000.0307.84
4.3.70.0030.0337.84
4.3.60.0030.0377.84
4.3.50.0030.0307.84
4.3.40.0070.0277.84
4.3.30.0000.0207.84
4.3.20.0030.0337.84
4.3.10.0000.0207.84
4.3.00.0000.0237.84

preferences:
44.31 ms | 401 KiB | 5 Q