3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i=0; $time = microtime(true); while($i < 50) { $i++; @preg_replace('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1_\\2" : "\\2")', 'VeryLongClassName'); } $time = microtime(true) - $time; echo '1: ' . number_format($time, 3) ."\n"; $i=0; $time = microtime(true); while($i < 50) { $i++; @preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', '_'.'$0', 'VeryLongClassName')); } $time = microtime(true) - $time; echo '2: ' . number_format($time, 3) ."\n";

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)
7.2.00.0000.01019.84
7.1.70.0030.00517.10
7.1.60.0060.01919.40
7.1.50.0090.00917.36
7.1.00.0000.07722.47
7.0.200.0000.00716.64
7.0.140.0030.07321.95
7.0.60.0370.07019.96
7.0.50.0100.03317.86
7.0.40.0100.05720.11
7.0.30.0170.04320.09
7.0.20.0230.04020.06
7.0.10.0170.04320.33
7.0.00.0070.05020.14
5.6.280.0030.07720.89
5.6.210.0070.08320.57
5.6.200.0130.08018.14
5.6.190.0300.04720.27
5.6.180.0230.08720.61
5.6.170.0270.03320.45
5.6.160.0170.04720.41
5.6.150.0100.04320.40
5.6.140.0200.03720.40
5.6.130.0200.03720.13
5.6.120.0100.04320.53
5.6.110.0230.05020.46
5.6.100.0070.05720.44
5.6.90.0130.04320.41
5.6.80.0200.08019.82
5.6.70.0100.04319.76
5.6.60.0170.04319.48
5.6.50.0170.04319.63
5.6.40.0170.03719.49
5.6.30.0130.04319.59
5.6.20.0130.04719.54
5.6.10.0170.03719.76
5.6.00.0130.04019.69
5.5.350.0230.07720.43
5.5.340.0000.06017.93
5.5.330.0230.08320.57
5.5.320.0200.04020.13
5.5.310.0200.04020.25
5.5.300.0230.04320.19
5.5.290.0130.04320.18
5.5.280.0200.04020.18
5.5.270.0130.04320.17
5.5.260.0170.04719.99
5.5.250.0300.03720.01
5.5.240.0170.03719.63
5.5.230.0170.06019.39
5.5.220.0200.04319.52
5.5.210.0200.05719.28
5.5.200.0270.02719.39
5.5.190.0130.04319.62
5.5.180.0170.03719.54
5.5.160.0200.04019.61
5.5.150.0130.04019.61
5.5.140.0200.03319.25
5.5.130.0070.04719.57
5.5.120.0070.05019.49
5.5.110.0170.03719.58
5.5.100.0130.04319.33
5.5.90.0100.04319.48
5.5.80.0170.03719.32
5.5.70.0200.04019.22
5.5.60.0100.04719.48
5.5.50.0230.04319.43
5.5.40.0270.07019.43
5.5.30.0330.06019.40
5.5.20.0330.06719.48
5.5.10.0330.06719.43
5.5.00.0170.05319.34
5.4.450.0170.05719.47
5.4.440.0170.03719.12
5.4.430.0170.05019.50
5.4.420.0130.04719.50
5.4.410.0230.04719.34
5.4.400.0130.04319.18
5.4.390.0200.06319.15
5.4.380.0130.06019.19
5.4.370.0170.04319.18
5.4.360.0130.03719.09
5.4.350.0230.03719.07
5.4.340.0100.04719.06
5.4.320.0200.03319.14
5.4.310.0170.03319.09
5.4.300.0130.04318.79
5.4.290.0100.04318.77
5.4.280.0130.03719.18
5.4.270.0070.04319.14
5.4.260.0200.04319.18
5.4.250.0100.04019.11
5.4.240.0100.04018.78
5.4.230.0100.04019.07
5.4.220.0170.04319.08
5.4.210.0170.07719.17
5.4.200.0170.04719.21
5.4.190.0300.06719.17
5.4.180.0170.04019.25
5.4.170.0200.07719.13
5.4.160.0200.08019.16
5.4.150.0200.04718.79
5.4.140.0230.07016.53
5.4.130.0300.07016.41
5.4.120.0200.04016.29
5.4.110.0330.06016.39
5.4.100.0230.06316.20
5.4.90.0170.04316.30
5.4.80.0230.04716.39
5.4.70.0270.05316.45
5.4.60.0200.04016.38
5.4.50.0300.05016.39
5.4.40.0230.06716.36
5.4.30.0270.06316.36
5.4.20.0230.03316.31
5.4.10.0270.03716.41
5.4.00.0230.03315.89
5.3.290.0100.04314.77
5.3.280.0170.06014.53
5.3.270.0300.06714.72
5.3.260.0230.07314.54
5.3.250.0230.04314.55
5.3.240.0270.03714.56
5.3.230.0230.06314.65
5.3.220.0270.06714.66
5.3.210.0230.04014.55
5.3.200.0170.04714.53
5.3.190.0130.05014.66
5.3.180.0300.06314.66
5.3.170.0200.05714.42
5.3.160.0300.05014.51
5.3.150.0230.07314.51
5.3.140.0230.03714.45
5.3.130.0200.04314.50
5.3.120.0130.04314.48
5.3.110.0270.05714.50
5.3.100.0200.03714.04
5.3.90.0330.06014.00
5.3.80.0270.07313.85
5.3.70.0230.03313.97
5.3.60.0270.06713.95
5.3.50.0330.06013.89
5.3.40.0300.04713.94
5.3.30.0300.05013.71
5.3.20.0200.04013.67
5.3.10.0200.03713.48
5.3.00.0200.04013.48
5.2.170.0170.05012.52
5.2.160.0270.03712.52
5.2.150.0130.07012.52
5.2.140.0270.02712.52
5.2.130.0230.03312.52
5.2.120.0170.05712.52
5.2.110.0130.06312.52
5.2.100.0200.05712.52
5.2.90.0170.04012.52
5.2.80.0100.04012.52
5.2.70.0130.06312.52
5.2.60.0200.05312.52
5.2.50.0100.06012.52
5.2.40.0230.04012.52
5.2.30.0100.05012.52
5.2.20.0130.06312.52
5.2.10.0170.03312.52
5.2.00.0130.04012.52
5.1.60.0200.05012.52
5.1.50.0130.04712.52
5.1.40.0200.04012.52
5.1.30.0130.06312.52
5.1.20.0130.06012.52
5.1.10.0200.05012.52
5.1.00.0170.04712.52
5.0.50.0070.05012.52
5.0.40.0130.03712.52
5.0.30.0070.04312.52
5.0.20.0200.02312.52
5.0.10.0130.02012.52
5.0.00.0070.03712.52
4.4.90.0070.03712.52
4.4.80.0100.03012.52
4.4.70.0030.03712.52
4.4.60.0030.02312.52
4.4.50.0030.03012.52
4.4.40.0070.04012.52
4.4.30.0070.03712.52
4.4.20.0100.02712.52
4.4.10.0130.03312.52
4.4.00.0170.05012.52
4.3.110.0030.03012.52
4.3.100.0070.02012.52
4.3.90.0070.02312.52
4.3.80.0070.05712.52
4.3.70.0030.02712.52
4.3.60.0130.03312.52
4.3.50.0170.03012.52
4.3.40.0100.04312.52
4.3.30.0030.04012.52
4.3.20.0030.03312.52
4.3.10.0000.04312.52
4.3.00.0070.03712.52

preferences:
35.43 ms | 401 KiB | 5 Q