3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bold($word, $sentence){ $result = preg_replace('~\b(' . preg_quote($word, '~') . ')\b~i', '<span class="found">$1</span>', $sentence); return $result; } $query = 'google'; $description = 'google this and that okay'; $thing = bold($query, $description); echo $thing;

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.0120.00618.52
8.3.50.0140.00322.11
8.3.40.0070.00718.59
8.3.30.0110.00418.93
8.3.20.0000.00818.69
8.3.10.0080.00020.72
8.3.00.0110.00017.61
8.2.180.0140.00316.63
8.2.170.0110.00422.96
8.2.160.0000.01522.20
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0000.00819.88
8.2.110.0060.00320.46
8.2.100.0120.00017.84
8.2.90.0040.00418.09
8.2.80.0000.00817.97
8.2.70.0030.00617.88
8.2.60.0080.00018.04
8.2.50.0000.00718.07
8.2.40.0000.00818.16
8.2.30.0030.00519.87
8.2.20.0000.00717.74
8.2.10.0040.00417.77
8.2.00.0060.00318.00
8.1.280.0040.01125.92
8.1.270.0000.00723.99
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0000.00822.14
8.1.230.0070.00720.91
8.1.220.0000.00817.74
8.1.210.0030.00618.88
8.1.200.0030.00617.35
8.1.190.0060.00317.54
8.1.180.0040.00418.10
8.1.170.0030.00618.74
8.1.160.0030.00318.96
8.1.150.0030.00518.74
8.1.140.0040.00417.59
8.1.130.0000.00717.86
8.1.120.0040.00417.63
8.1.110.0000.00717.65
8.1.100.0000.00717.61
8.1.90.0070.00017.63
8.1.80.0040.00417.61
8.1.70.0070.00317.50
8.1.60.0040.00417.65
8.1.50.0000.00817.53
8.1.40.0060.00317.65
8.1.30.0040.00417.68
8.1.20.0000.00817.72
8.1.10.0040.00417.66
8.1.00.0030.00617.60
8.0.300.0040.00419.95
8.0.290.0040.00416.88
8.0.280.0070.00018.57
8.0.270.0000.00717.26
8.0.260.0030.00316.89
8.0.250.0000.00716.98
8.0.240.0000.01017.01
8.0.230.0050.00317.01
8.0.220.0000.00716.97
8.0.210.0070.00017.00
8.0.200.0030.00517.14
8.0.190.0000.00817.07
8.0.180.0070.00016.96
8.0.170.0060.00316.99
8.0.160.0000.00817.10
8.0.150.0060.00316.90
8.0.140.0030.00917.06
8.0.130.0060.00013.47
8.0.120.0040.00416.88
8.0.110.0000.00817.05
8.0.100.0000.00716.95
8.0.90.0070.00017.04
8.0.80.0100.00717.10
8.0.70.0020.00517.11
8.0.60.0050.00216.95
8.0.50.0050.00316.97
8.0.30.0090.01017.41
8.0.20.0110.00817.48
8.0.10.0070.00017.07
8.0.00.0110.00616.97
7.4.330.0030.00314.83
7.4.320.0060.00016.67
7.4.300.0060.00016.64
7.4.290.0080.00016.83
7.4.280.0050.00316.62
7.4.270.0070.00016.79
7.4.260.0050.00313.59
7.4.250.0060.00316.78
7.4.240.0000.00716.80
7.4.230.0030.00316.75
7.4.220.0120.00816.77
7.4.210.0070.01216.79
7.4.200.0040.00416.65
7.4.190.0030.00316.88
7.4.160.0130.00316.58
7.4.150.0160.00317.40
7.4.140.0060.01017.86
7.4.130.0080.00916.72
7.4.120.0070.01016.66
7.4.110.0100.00616.65
7.4.100.0150.00616.79
7.4.90.0060.01116.54
7.4.80.0060.01019.04
7.4.70.0100.01416.75
7.4.60.0130.00616.45
7.4.50.0060.00316.60
7.4.40.0070.01022.27
7.4.30.0040.01216.63
7.4.00.0090.00315.39
7.3.330.0000.00613.23
7.3.320.0000.00513.23
7.3.310.0000.00716.50
7.3.300.0050.00316.41
7.3.290.0100.00516.37
7.3.280.0040.01016.41
7.3.270.0060.01117.40
7.3.260.0080.00918.24
7.3.250.0070.01016.56
7.3.240.0070.01116.84
7.3.230.0090.00916.79
7.3.210.0130.00316.66
7.3.200.0100.00719.39
7.3.190.0060.01116.74
7.3.180.0060.01116.48
7.3.170.0130.00716.52
7.3.160.0060.01016.78
7.3.120.0030.00915.30
7.3.10.0090.00916.44
7.3.00.0090.00916.53
7.2.330.0110.00816.80
7.2.320.0090.00916.88
7.2.310.0160.00716.64
7.2.300.0060.01016.59
7.2.290.0100.00716.93
7.2.130.0140.00616.83
7.2.120.0060.01516.79
7.2.110.0100.01416.58
7.2.100.0110.01116.71
7.2.90.0170.00316.77
7.2.80.0100.01016.78
7.2.70.0110.01116.81
7.2.60.0230.00816.99
7.2.50.0200.01016.78
7.2.40.0140.00817.03
7.2.30.0090.01216.95
7.2.20.0100.00916.95
7.2.10.0180.00716.80
7.2.00.0080.01218.30
7.1.250.0150.00415.34
7.1.100.0040.00718.48
7.1.70.0000.00817.46
7.1.60.0180.00619.40
7.1.50.0040.00817.12
7.1.00.0130.04722.45
7.0.200.0040.00416.84
7.0.140.0030.07322.07
7.0.60.0130.07321.66
7.0.50.0000.05017.98
7.0.40.0100.05720.15
7.0.30.0400.06720.09
7.0.20.0300.08020.20
7.0.10.0100.06320.32
7.0.00.0030.04020.24
5.6.280.0000.07721.13
5.6.210.0070.08720.54
5.6.200.0100.07018.27
5.6.190.0070.08020.41
5.6.180.0230.08020.48
5.6.170.0370.07320.53
5.6.160.0030.04020.56
5.6.150.0070.04718.18
5.6.140.0070.06718.14
5.6.130.0100.07318.11
5.6.120.0100.03320.98
5.6.110.0070.04021.02
5.6.100.0000.08020.98
5.6.90.0030.04321.13
5.6.80.0130.03020.39
5.5.350.0200.07320.31
5.5.340.0000.04017.97
5.5.330.0030.08720.31
5.5.320.0270.03720.51
5.5.310.0170.05720.35
5.5.300.0030.08318.01
5.5.290.0030.08318.05
5.5.280.0100.05020.82
5.5.270.0100.05720.75
5.5.260.0100.08020.77
5.5.250.0100.07720.71
5.5.240.0070.06720.27
5.4.450.0070.04719.34
5.4.440.0070.08719.47
5.4.430.0000.08019.47
5.4.420.0070.07019.19
5.4.410.0070.07019.34
5.4.400.0030.08018.86
5.4.390.0100.04718.86
5.4.380.0070.03719.12
5.4.370.0200.06719.24
5.4.360.0130.04719.24
5.4.350.0000.05319.07
5.4.340.0000.04719.00
5.4.320.0070.03719.12
5.4.310.0030.04019.01
5.4.300.0030.08319.00
5.4.290.0100.06719.20
5.4.280.0070.08019.14
5.4.270.0100.04319.14
5.4.260.0030.03719.15
5.4.250.0030.03719.11
5.4.240.0070.03318.97
5.4.230.0070.03319.23
5.4.220.0070.03318.97
5.4.210.0070.03319.25
5.4.200.0030.04719.11
5.4.190.0000.07019.23
5.4.180.0100.03019.13
5.4.170.0070.04718.99
5.4.160.0030.03719.22
5.4.150.0000.04018.91
5.4.140.0000.04016.43
5.4.130.0030.03316.31
5.4.120.0030.04016.37
5.4.110.0000.03716.52
5.4.100.0070.03316.35
5.4.90.0030.04716.45
5.4.80.0030.05716.49
5.4.70.0100.06716.44
5.4.60.0070.06716.36
5.4.50.0000.03716.41
5.4.40.0030.03716.38
5.4.30.0070.03316.44
5.4.20.0100.03016.50
5.4.10.0000.03716.50
5.4.00.0000.04315.79
5.3.290.0100.07014.70
5.3.280.0000.04014.63
5.3.270.0070.03714.59
5.3.260.0000.04314.65
5.3.250.0030.03714.63
5.3.240.0000.04014.66
5.3.230.0030.04314.59
5.3.220.0130.04014.65
5.3.210.0000.04014.72
5.3.200.0100.03314.56
5.3.190.0030.03714.64
5.3.180.0070.03314.61
5.3.170.0070.03714.59
5.3.160.0000.04014.72
5.3.150.0070.04014.59
5.3.140.0070.03314.55
5.3.130.0000.04014.59
5.3.120.0030.03714.61
5.3.110.0130.02714.60
5.3.100.0100.03314.04
5.3.90.0000.03714.04
5.3.80.0070.03314.07
5.3.70.0000.03714.02
5.3.60.0070.03013.89
5.3.50.0030.03314.00
5.3.40.0000.04013.89
5.3.30.0030.03313.93
5.3.20.0030.03313.72
5.3.10.0070.03713.80
5.3.00.0030.03313.64
5.2.170.0000.03011.14
5.2.160.0000.03011.18
5.2.150.0030.02711.19
5.2.140.0030.03011.05
5.2.130.0030.03311.16
5.2.120.0070.03011.15
5.2.110.0030.02711.09
5.2.100.0000.03011.15
5.2.90.0000.03011.06
5.2.80.0030.03711.24
5.2.70.0070.03711.23
5.2.60.0070.03710.97
5.2.50.0030.03011.03
5.2.40.0000.03011.05
5.2.30.0000.03010.98
5.2.20.0070.05310.97
5.2.10.0030.05010.82
5.2.00.0030.03310.71
5.1.60.0070.03310.13
5.1.50.0000.03010.01
5.1.40.0000.0279.97
5.1.30.0170.02310.34
5.1.20.0030.05710.31
5.1.10.0070.03010.06
5.1.00.0030.02710.05
5.0.50.0070.0178.53
5.0.40.0070.0178.48
5.0.30.0030.0638.29
5.0.20.0030.0278.21
5.0.10.0000.0238.22
5.0.00.0000.0678.16
4.4.90.0000.0377.40
4.4.80.0030.0177.40
4.4.70.0000.0307.40
4.4.60.0070.0307.40
4.4.50.0030.0277.40
4.4.40.0000.0537.40
4.4.30.0030.0137.40
4.4.20.0070.0277.40
4.4.10.0000.0177.40
4.4.00.0030.0277.40
4.3.110.0000.0307.40
4.3.100.0000.0307.40
4.3.90.0000.0237.40
4.3.80.0000.0307.40
4.3.70.0070.0307.40
4.3.60.0070.0107.40
4.3.50.0000.0177.40
4.3.40.0000.0507.40
4.3.30.0000.0207.40
4.3.20.0030.0207.40
4.3.10.0000.0177.40
4.3.00.0030.0137.40

preferences:
50.05 ms | 401 KiB | 5 Q