3v4l.org

run code in 300+ PHP versions simultaneously
<?php function findBase(string $t): string|null { $matches = []; preg_match('/(?P<name>\.([^\.])*)$/', $t, $matches); if (!isset($matches['name'])) { return $t; }; return substr($t, 0, -1 * strlen($matches['name'])); } var_dump(findBase('')); var_dump(findBase('foo')); var_dump(findBase('foo.bar')); var_dump(findBase('foo.bar.baz')); var_dump(findBase('foo.bar[0].baz'));

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.110.0160.00316.74
8.3.100.0080.00024.06
8.3.90.0000.00726.77
8.3.80.0120.00017.97
8.3.70.0130.00918.43
8.3.60.0100.00618.55
8.3.50.0040.01118.38
8.3.40.0030.01020.35
8.3.30.0120.00318.96
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0000.00726.16
8.2.230.0060.00320.94
8.2.220.0060.00637.54
8.2.210.0080.00026.77
8.2.200.0090.00016.63
8.2.190.0110.00417.00
8.2.180.0090.00616.50
8.2.170.0140.00019.08
8.2.160.0150.00022.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00826.16
8.2.110.0000.00919.08
8.2.100.0050.00518.03
8.2.90.0070.00317.97
8.2.80.0040.00417.75
8.2.70.0060.00317.88
8.2.60.0000.00818.05
8.2.50.0060.00318.07
8.2.40.0040.00718.28
8.2.30.0070.00018.14
8.2.20.0040.00419.33
8.2.10.0040.00717.75
8.2.00.0060.00317.76
8.1.290.0030.00630.84
8.1.280.0070.00725.92
8.1.270.0080.00024.66
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00322.02
8.1.230.0080.00421.02
8.1.220.0040.00417.74
8.1.210.0000.01018.86
8.1.200.0070.00317.35
8.1.190.0040.00417.47
8.1.180.0000.00722.04
8.1.170.0080.00018.94
8.1.160.0050.00318.92
8.1.150.0040.00418.69
8.1.140.0130.00317.66
8.1.130.0110.00417.60
8.1.120.0120.00617.65
8.1.110.0140.00517.65
8.1.100.0130.00317.69
8.1.90.0160.00017.55
8.1.80.0120.00317.63
8.1.70.0130.00317.71
8.1.60.0130.00517.85
8.1.50.0170.00317.73
8.1.40.0190.00317.80
8.1.30.0140.00717.81
8.1.20.0160.00417.71
8.1.10.0150.00417.67
8.1.00.0170.00317.61
8.0.300.0040.00419.91
8.0.290.0070.00016.75
8.0.280.0030.00318.48
8.0.270.0120.00216.96
8.0.260.0160.00016.91
8.0.250.0110.00217.10
8.0.240.0100.00617.00
8.0.230.0110.00217.09
8.0.220.0070.00716.89
8.0.210.0090.00316.97
8.0.200.0000.01016.93
8.0.190.0070.00417.03
8.0.180.0090.00316.92
8.0.170.0130.00316.91
8.0.160.0040.00917.13
8.0.150.0130.00216.89
8.0.140.0110.00516.87
8.0.130.0120.00416.96
8.0.120.0140.00017.00
8.0.110.0120.00316.86
8.0.100.0060.00817.02
8.0.90.0130.00316.97
8.0.80.0090.00517.00
8.0.70.0110.00416.86
8.0.60.0110.00316.84
8.0.50.0090.00616.93
8.0.30.0100.00416.95
8.0.20.0120.00317.01
8.0.10.0070.00416.95

preferences:
26.61 ms | 403 KiB | 5 Q