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 "working 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'],$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.40.0120.00918.83
8.3.30.0090.00618.63
8.3.20.0060.01018.77
8.3.10.0100.00018.92
8.3.00.0080.00019.51
8.2.170.0030.01022.96
8.2.160.0110.00421.23
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00418.75
8.2.110.0060.00322.25
8.2.100.0040.00819.07
8.2.90.0000.00817.75
8.2.80.0030.00617.97
8.2.70.0050.00318.05
8.2.60.0040.00418.16
8.2.50.0040.00419.21
8.2.40.0040.00418.16
8.2.30.0050.00317.96
8.2.20.0000.00717.76
8.2.10.0000.00817.69
8.2.00.0000.00817.70
8.1.270.0040.00424.66
8.1.260.0040.01226.35
8.1.250.0050.00328.09
8.1.240.0030.00622.25
8.1.230.0090.00318.97
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0070.00717.35
8.1.190.0080.00017.36
8.1.180.0040.00418.10
8.1.170.0000.00818.53
8.1.160.0070.00018.91
8.1.150.0080.00018.72
8.1.140.0040.00417.43
8.1.130.0000.00717.82
8.1.120.0070.00017.50
8.1.110.0000.00717.48
8.1.100.0040.00417.47
8.1.90.0000.00717.45
8.1.80.0040.00417.53
8.1.70.0000.00717.50
8.1.60.0060.00317.65
8.1.50.0080.00017.47
8.1.40.0090.00017.53
8.1.30.0080.00017.61
8.1.20.0030.00517.59
8.1.10.0000.00817.50
8.1.00.0000.00817.50
8.0.300.0040.00419.82
8.0.290.0070.00316.75
8.0.280.0060.00318.43
8.0.270.0070.00017.25
8.0.260.0050.00316.94
8.0.250.0000.00817.01
8.0.240.0100.00016.88
8.0.230.0000.00717.03
8.0.220.0000.00716.83
8.0.210.0030.00516.89
8.0.200.0030.00317.05
8.0.190.0030.00517.03
8.0.180.0070.00016.96
8.0.170.0070.00016.86
8.0.160.0000.00816.80
8.0.150.0000.00916.92
8.0.140.0040.00816.91
8.0.130.0000.00613.32
8.0.120.0020.00516.90
8.0.110.0020.00516.92
8.0.100.0000.00816.99
8.0.90.0020.00516.82
8.0.80.0030.01216.91
8.0.70.0030.00516.80
8.0.60.0000.00716.82
8.0.50.0040.00416.95
8.0.30.0100.01017.03
8.0.20.0100.00917.15
8.0.10.0000.00717.09
8.0.00.0140.00816.68
7.4.330.0020.00213.04
7.4.320.0000.00616.50
7.4.300.0000.00616.50
7.4.290.0040.00416.53
7.4.280.0040.00416.68
7.4.270.0040.00416.59
7.4.260.0000.00613.30
7.4.250.0000.00716.55
7.4.240.0020.00516.58
7.4.230.0030.00316.43
7.4.220.0170.00416.60
7.4.210.0090.00716.62
7.4.200.0040.00416.71
7.4.190.0000.00716.70
7.4.160.0040.01116.52
7.4.150.0110.00716.56
7.4.140.0060.01516.56
7.4.130.0090.00916.64
7.4.120.0150.00416.46
7.4.110.0040.01416.43
7.4.100.0000.01816.51
7.4.90.0170.00316.63
7.4.80.0120.00819.39
7.4.70.0130.00316.43
7.4.60.0060.00916.74
7.4.50.0060.00616.63
7.4.40.0030.00716.64
7.4.30.0080.00816.48
7.4.10.0100.01014.87
7.4.00.0080.00715.06
7.3.330.0030.00313.16
7.3.320.0000.00813.06
7.3.310.0070.00016.46
7.3.300.0050.00216.30
7.3.290.0100.01016.36
7.3.280.0100.00816.42
7.3.270.0080.00916.58
7.3.260.0110.00916.53
7.3.250.0090.01016.55
7.3.240.0150.00616.68
7.3.230.0080.00916.59
7.3.210.0130.01016.43
7.3.200.0130.00316.27
7.3.190.0090.00916.59
7.3.180.0040.01216.42
7.3.170.0090.01216.61
7.3.160.0100.00616.39
7.3.130.0060.01015.13
7.3.120.0070.01014.76
7.3.110.0130.00715.11
7.3.100.0110.00314.99
7.3.90.0090.00614.76
7.3.80.0000.01214.84
7.3.70.0030.00914.57
7.3.60.0000.01014.99
7.3.50.0140.00014.79
7.3.40.0070.00714.82
7.3.30.0100.00314.89
7.3.20.0060.00316.57
7.3.10.0040.00716.78
7.3.00.0070.00716.74
7.2.330.0120.00616.45
7.2.320.0000.01716.90
7.2.310.0120.01216.68
7.2.300.0120.00416.88
7.2.290.0030.01416.71
7.2.260.0030.01014.93
7.2.250.0040.01515.05
7.2.240.0080.00814.99
7.2.230.0060.01015.30
7.2.220.0070.01015.01
7.2.210.0030.01015.13
7.2.200.0040.01115.05
7.2.190.0060.00615.18
7.2.180.0110.00715.09
7.2.170.0030.00614.92
7.2.160.0110.00415.12
7.2.150.0030.01216.95
7.2.140.0080.00417.02
7.2.130.0070.00716.93
7.2.120.0000.00917.11
7.2.110.0030.00617.00
7.2.100.0040.00816.72
7.2.90.0030.01317.00
7.2.80.0030.00717.07
7.2.70.0040.00816.86
7.2.60.0060.00317.07
7.2.50.0140.00017.03
7.2.40.0000.01517.00
7.2.30.0000.01117.06
7.2.20.0030.01416.86
7.2.10.0030.00916.99
7.2.00.0010.01118.27
7.1.330.0030.00915.82
7.1.320.0070.00715.70
7.1.310.0000.01415.68
7.1.300.0060.00615.80
7.1.290.0030.00915.55
7.1.280.0000.00915.84
7.1.270.0000.00915.69
7.1.260.0000.01415.92
7.1.250.0030.01015.96
7.1.240.0060.00315.86
7.1.230.0070.00715.77
7.1.220.0060.00615.83
7.1.210.0090.00615.61
7.1.200.0070.00715.76
7.1.190.0030.01015.88
7.1.180.0100.00315.93
7.1.170.0060.00615.82
7.1.160.0030.00616.00
7.1.150.0030.00615.93
7.1.140.0040.00715.88
7.1.130.0080.00615.76
7.1.120.0070.00715.89
7.1.110.0050.00315.82
7.1.100.0080.00816.92
7.1.90.0090.00915.70
7.1.80.0090.00915.98
7.1.70.0050.00516.61
7.1.60.0110.00817.63
7.1.50.0020.01016.43
7.1.40.0000.01315.74
7.1.30.0040.01115.86
7.1.20.0030.00915.85
7.1.10.0070.00315.82
7.1.00.0030.03619.04
7.0.330.0110.00415.34
7.0.320.0070.00715.61
7.0.310.0100.00315.57
7.0.300.0040.01115.63
7.0.290.0090.00315.43
7.0.280.0070.00715.44
7.0.270.0060.00615.48
7.0.260.0050.00515.44
7.0.250.0050.00515.52
7.0.240.0040.01415.46
7.0.230.0090.00915.54
7.0.220.0000.01315.55
7.0.210.0060.00915.63
7.0.200.0020.00715.99
7.0.190.0030.00615.33
7.0.180.0050.00815.55
7.0.170.0000.01115.30
7.0.160.0040.00815.52
7.0.150.0030.01015.33
7.0.140.0070.04018.80
7.0.130.0030.00715.30
7.0.120.0050.03718.71
7.0.110.0030.00615.57
7.0.100.0060.00615.56
7.0.90.0030.01015.57
7.0.80.0110.00315.42
7.0.70.0030.01015.18
7.0.60.0080.03617.70
7.0.50.0050.04516.65
7.0.40.0050.04216.95
7.0.30.0110.02917.08
7.0.20.0120.03716.96
7.0.10.0100.04217.01
7.0.00.0060.02716.97
5.6.400.0030.00614.78
5.6.390.0100.00714.75
5.6.380.0000.00814.46
5.6.370.0090.00014.85
5.6.360.0130.00314.73
5.6.350.0000.01114.32
5.6.340.0040.01114.29
5.6.330.0000.01514.88
5.6.320.0130.00614.71
5.6.310.0100.00314.34
5.6.300.0090.00614.36
5.6.290.0000.01314.79
5.6.280.0000.01014.23
5.6.270.0070.00714.16
5.6.260.0030.01014.20
5.6.250.0130.00014.65
5.6.240.0030.00614.40
5.6.230.0040.00414.24
5.6.220.0030.01314.61
5.6.210.0080.04417.63
5.6.200.0030.04716.32
5.6.190.0070.02917.37
5.6.180.2220.02017.53
5.6.170.0130.02917.44
5.6.160.0090.04517.45
5.6.150.0110.02316.35
5.6.140.0080.03616.45
5.6.130.0030.02516.30
5.6.120.0080.04717.74
5.6.110.0090.04417.64
5.6.100.0100.04217.80
5.6.90.0100.04217.73
5.6.80.0050.04817.44
5.6.70.0030.00914.32
5.6.60.0030.00914.35
5.6.50.0030.00614.25
5.6.40.0000.01014.46
5.6.30.0000.01314.38
5.6.20.0030.01014.50
5.6.10.0080.00314.38
5.6.00.0080.00314.56
5.5.380.0080.00014.70
5.5.370.0040.00714.16
5.5.360.0060.01014.48
5.5.350.1650.02417.32
5.5.340.0070.02216.22
5.5.330.0090.03117.52
5.5.320.1520.02817.37
5.5.310.0240.03717.45
5.5.300.0000.02716.26
5.5.290.0050.02316.11
5.5.280.0110.03017.63
5.5.270.0050.03417.76
5.5.260.0080.04617.73
5.5.250.0070.02217.40
5.5.240.2100.02217.30
5.5.230.0030.00614.39
5.5.220.0030.00714.18
5.5.210.0060.00914.54
5.5.200.0070.00714.59
5.5.190.0000.01014.11
5.5.180.0030.00914.32
5.5.170.0040.00714.59
5.5.160.0060.00614.57
5.5.150.0080.00013.99
5.5.140.0030.01014.13
5.5.130.0060.00914.38
5.5.120.0000.00914.27
5.5.110.0000.00814.46
5.5.100.0060.00614.24
5.5.90.0000.01514.45
5.5.80.0060.00614.24
5.5.70.0000.00814.23
5.5.60.0100.00314.46
5.5.50.0000.01113.88
5.5.40.0030.00914.38
5.5.30.0040.00914.20
5.5.20.0070.00414.19
5.5.10.0030.01014.32
5.5.00.0040.00814.52
5.4.450.0060.04316.68
5.4.440.0000.02716.68
5.4.430.0000.02716.67
5.4.420.0080.03416.67
5.4.410.0080.02016.52
5.4.400.0080.03516.52
5.4.390.0070.03816.38
5.4.380.0070.03716.51
5.4.370.0030.04116.38
5.4.360.0060.03816.39
5.4.350.0070.04116.46
5.4.340.0040.03816.43
5.4.330.0000.00913.85
5.4.320.0080.04116.51
5.4.310.0070.03816.46
5.4.300.0080.03816.50
5.4.290.0100.03216.51
5.4.280.0020.04216.51
5.4.270.0030.03316.46
5.4.260.0070.03816.43
5.4.250.0060.02516.51
5.4.240.0000.04316.50
5.4.230.0050.04216.31
5.4.220.0060.02916.33
5.4.210.0100.04016.51
5.4.200.0060.02116.33
5.4.190.0010.02816.49
5.4.180.0050.03816.46
5.4.170.0080.03716.42
5.4.160.0030.03116.31
5.4.150.0100.02516.50
5.4.140.0040.04015.06
5.4.130.0030.04215.14
5.4.120.0090.03315.09
5.4.110.0070.03815.13
5.4.100.0030.02915.23
5.4.90.0070.01715.08
5.4.80.0040.02215.13
5.4.70.0050.02315.09
5.4.60.0070.01515.11
5.4.50.0020.02115.08
5.4.40.0030.02315.21
5.4.30.0020.02415.08
5.4.20.0050.02015.10
5.4.10.0060.01815.04
5.4.00.0030.02414.73
5.3.290.0070.02214.24
5.3.280.0050.04014.21
5.3.270.0040.04214.22
5.3.260.0050.03714.20
5.3.250.0070.01814.21
5.3.240.0050.03814.28
5.3.230.0200.01814.20
5.3.220.0030.03614.19
5.3.210.0050.02314.23
5.3.200.0080.03314.19
5.3.190.0030.02514.17
5.3.180.0070.02014.20
5.3.170.0020.02714.20
5.3.160.0070.02114.18
5.3.150.0020.02514.17
5.3.140.0020.02114.18
5.3.130.0020.02514.18
5.3.120.0050.02114.20
5.3.110.0020.02314.17
5.3.100.0030.02113.95
5.3.90.0030.02013.91
5.3.80.0030.02313.94
5.3.70.0080.01813.92
5.3.60.0020.02213.85
5.3.50.0030.02013.83
5.3.40.0020.02313.89
5.3.30.0050.01913.94
5.3.20.0030.02013.75
5.3.10.0070.01713.68
5.3.00.0030.01813.73
5.2.170.0000.03011.14
5.2.160.0000.03011.12
5.2.150.0030.02711.03
5.2.140.0000.03011.18
5.2.130.0030.02711.02
5.2.120.0000.03011.29
5.2.110.0100.02011.03
5.2.100.0130.02311.28
5.2.90.0130.02011.07
5.2.80.0030.03011.01
5.2.70.0000.03011.05
5.2.60.0030.02711.05
5.2.50.0000.03011.05
5.2.40.0030.03011.10
5.2.30.0070.02710.94
5.2.20.0030.02711.06
5.2.10.0030.02710.92
5.2.00.0000.03010.79
5.1.60.0070.02010.12
5.1.50.0000.02710.07
5.1.40.0030.0239.90
5.1.30.0000.02710.34
5.1.20.0070.02310.53
5.1.10.0000.02710.09
5.1.00.0030.02310.13
5.0.50.0030.0208.59
5.0.40.0030.0208.46
5.0.30.0100.0538.24
5.0.20.0030.0208.21
5.0.10.0070.0408.27
5.0.00.0030.0338.18
4.4.90.0030.0138.03
4.4.80.0000.0178.03
4.4.70.0000.0178.03
4.4.60.0070.0108.03
4.4.50.0000.0178.03
4.4.40.0000.0238.03
4.4.30.0000.0178.03
4.4.20.0030.0138.03
4.4.10.0000.0178.03
4.4.00.0000.0238.03
4.3.110.0000.0208.03
4.3.100.0000.0238.03
4.3.90.0000.0238.03
4.3.80.0000.0278.03
4.3.70.0030.0138.03
4.3.60.0030.0208.03
4.3.50.0000.0238.03
4.3.40.0070.0508.03
4.3.30.0000.0378.03
4.3.20.0070.0278.03
4.3.10.0000.0308.03
4.3.00.0000.0308.03

preferences:
52.34 ms | 400 KiB | 5 Q