3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace yii\db; class test { function formName1() { $class = get_class($this); $pos = strrpos($class, '\\'); return $pos === false ? $class : substr($class, $pos + 1); } function formName2() { $reflector = new \ReflectionClass($this); return $reflector->getShortName(); } } $test = new test; $rounds = 1000000; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $test->formName1(); } echo (microtime(true) - $start); echo "\n"; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $test->formName2(); } echo (microtime(true) - $start);

Abusive script

This script was stopped while abusing our resources

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.4.10.0030.56314.92
7.4.00.0070.65015.10
7.3.130.0030.90415.12
7.3.120.0070.70314.69
7.3.110.0130.88414.80
7.3.100.0070.61514.77
7.3.90.0000.63114.88
7.3.80.0030.72214.82
7.3.70.0070.76814.67
7.3.60.0030.83114.89
7.3.50.0030.84514.59
7.3.40.0030.60614.64
7.3.30.0030.83814.80
7.3.20.0030.70016.72
7.3.10.0070.59316.27
7.3.00.0090.58116.29
7.2.260.0070.98415.27
7.2.250.0070.98714.95
7.2.240.0100.72514.91
7.2.230.0100.98314.85
7.2.220.0000.71715.30
7.2.210.0030.92715.26
7.2.200.0070.74914.97
7.2.190.0031.01615.20
7.2.180.0030.94214.93
7.2.170.0030.81415.13
7.2.160.0070.94814.86
7.2.150.0000.64516.99
7.2.140.0100.81916.85
7.2.130.0080.83216.91
7.2.120.0080.82016.96
7.2.110.0080.80916.72
7.2.100.0030.73916.77
7.2.90.0080.72816.74
7.2.80.0050.72316.73
7.2.70.0080.84716.79
7.2.60.0030.68016.72
7.2.50.0120.68916.67
7.2.40.0100.78916.77
7.2.30.0080.80116.94
7.2.20.0050.64216.73
7.2.10.0100.81016.80
7.2.00.0080.67317.75
7.1.330.0031.05015.59
7.1.320.0101.13415.66
7.1.310.0071.13715.77
7.1.300.0001.18715.80
7.1.290.0000.94515.57
7.1.280.0070.99115.91
7.1.270.0071.06215.79
7.1.260.0031.04515.47
7.1.250.0080.94615.60
7.1.240.0031.22615.85
7.1.230.0101.28315.86
7.1.220.0000.97515.82
7.1.210.0031.10415.93
7.1.200.0020.72715.71
7.1.190.0001.26115.93
7.1.180.0000.93315.61
7.1.170.0100.93315.68
7.1.160.0031.34515.79
7.1.150.0070.93715.71
7.1.140.0001.25515.72
7.1.130.0071.26515.72
7.1.120.0031.25915.85
7.1.110.0031.13815.44
7.1.100.0070.76516.91
7.1.90.0001.11315.71
7.1.80.0071.34015.75
7.1.70.0030.85416.11
7.1.60.0120.73017.53
7.1.50.0030.70516.50
7.1.40.0101.22016.00
7.1.30.0071.25515.84
7.1.20.0001.20915.85
7.1.10.0001.16915.67
7.1.00.0080.89119.00
7.0.330.0031.25715.34
7.0.320.0031.09515.31
7.0.310.0031.24615.36
7.0.300.0000.90715.14
7.0.290.0071.34315.39
7.0.280.0071.10315.34
7.0.270.0031.03315.43
7.0.260.0071.18315.32
7.0.250.0031.14915.14
7.0.240.0101.09115.35
7.0.230.0030.92615.12
7.0.220.0031.28915.57
7.0.210.0031.23815.28
7.0.200.0050.70315.99
7.0.190.0070.92315.39
7.0.180.0031.24215.44
7.0.170.0070.95515.53
7.0.160.0031.25115.34
7.0.150.0100.94915.08
7.0.140.0100.79818.57
7.0.130.0031.24915.17
7.0.120.0070.99015.18
7.0.110.0101.03914.82
7.0.100.0031.08115.12
7.0.90.0001.10615.46
7.0.80.0071.27215.04
7.0.70.0071.29615.45
7.0.60.0030.72917.66
7.0.50.0080.81916.62
7.0.40.0070.82915.60
7.0.30.0030.90915.46
7.0.20.0020.85515.67
7.0.10.0120.75415.44
7.0.00.0750.90415.66
5.6.400.0032.49614.32
5.6.390.0072.28914.36
5.6.380.0072.49014.11
5.6.370.0032.49613.99
5.6.360.0032.20614.32
5.6.350.0032.16514.28
5.6.340.0032.36814.24
5.6.330.0081.97713.98
5.6.320.0032.49514.52
5.6.310.0002.37914.52
5.6.300.0031.89814.11
5.6.290.0102.48914.10
5.6.280.0021.86417.55
5.6.270.0032.46214.25
5.6.260.0002.03514.10
5.6.250.0002.36314.27
5.6.240.0072.49214.32
5.6.230.0002.49914.24
5.6.220.0032.16314.04
5.6.210.0071.75817.53
5.6.200.0131.80416.23
5.6.190.0071.82516.21
5.6.180.0071.56016.34
5.6.170.0031.78716.29
5.6.160.0001.82616.10
5.6.150.0031.81316.07
5.6.140.0081.77316.15
5.6.130.0031.78616.05
5.6.120.0081.72816.13
5.6.110.0051.67116.09
5.6.100.0031.77616.16
5.6.90.0081.69716.17
5.6.80.0021.81515.80
5.6.70.0051.78815.95
5.6.60.0051.73715.76
5.6.50.0081.67715.83
5.6.40.0031.52915.85
5.6.30.0081.82615.92
5.6.20.0121.78115.70
5.6.10.0051.84415.99
5.6.00.0051.80815.74
5.5.380.0072.45914.38
5.5.370.0072.49113.93
5.5.360.0072.28713.98
5.5.350.0081.51217.25
5.5.340.0071.80916.01
5.5.330.0021.61116.13
5.5.320.0081.79116.18
5.5.310.0051.61116.22
5.5.300.0051.82216.16
5.5.290.0071.69216.20
5.5.280.0071.66316.05
5.5.270.0031.79316.05
5.5.260.0031.80416.19
5.5.250.0071.75716.06
5.5.240.0111.55415.70
5.5.230.0051.55715.46
5.5.220.0031.81115.71
5.5.210.0051.84615.80
5.5.200.0051.82315.55
5.5.190.0031.84115.77
5.5.180.0081.77815.69
5.5.170.0032.23013.81
5.5.160.0071.82915.85
5.5.150.0071.77515.77
5.5.140.0051.80415.64
5.5.130.0031.88615.79
5.5.120.0081.58715.69
5.5.110.0051.80215.55
5.5.100.0101.79715.49
5.5.90.0071.80815.58
5.5.80.1281.80115.62
5.5.70.0071.58515.70
5.5.60.0051.82315.62
5.5.50.0031.80615.58
5.5.40.0101.78515.61
5.5.30.0031.79415.63
5.5.20.0071.65215.78
5.5.10.0081.78615.57
5.5.00.1221.76015.53
5.4.450.0051.77715.38
5.4.440.0031.72915.10
5.4.430.0081.80015.27
5.4.420.0151.73615.18
5.4.410.0051.79415.27
5.4.400.0101.73014.97
5.4.390.0051.59215.14
5.4.380.0101.78214.90
5.4.370.0101.57414.88
5.4.360.0081.75115.02
5.4.350.0081.65015.10
5.4.340.0061.62114.93
5.4.330.0002.47710.92
5.4.320.0031.81815.02
5.4.310.0031.53815.09
5.4.300.0051.61115.00
5.4.290.0031.82115.04
5.4.280.0051.82214.98
5.4.270.0021.77214.97
5.4.260.1151.58115.01
5.4.250.0051.77915.08
5.4.240.0031.78114.86
5.4.230.1501.64114.93
5.4.220.0051.83615.03
5.4.210.0051.61314.98
5.4.200.0071.52815.15
5.4.190.0071.79015.01
5.4.180.0071.70815.01
5.4.170.0071.80915.08
5.4.160.0051.65215.12
5.4.150.0071.80815.04
5.4.140.0051.63013.69
5.4.130.0051.82113.73
5.4.120.0071.80213.64
5.4.110.0051.78613.52
5.4.100.0131.82113.61
5.4.90.0051.73313.65
5.4.80.0051.77013.52
5.4.70.0021.64113.55
5.4.60.0051.76713.52
5.4.50.0031.81513.45
5.4.40.0051.80413.54
5.4.30.0061.78913.46
5.4.20.0051.79913.37
5.4.10.0021.81613.70
5.4.00.0071.70213.50
5.3.290.0052.02312.71
5.3.280.0051.97512.52
5.3.270.0032.02512.55
5.3.260.0052.10112.57
5.3.250.0022.15312.54
5.3.240.0022.02212.52
5.3.230.0082.01012.58
5.3.220.0052.03212.28
5.3.210.0052.00712.41
5.3.200.0032.11512.45
5.3.190.0052.03212.53
5.3.180.0072.00412.51
5.3.170.0002.20912.51
5.3.160.0002.05012.52
5.3.150.0052.20812.46
5.3.140.0152.00112.39
5.3.130.0022.00912.44
5.3.120.0072.05612.47
5.3.110.0052.00912.45
5.3.100.0072.03412.23
5.3.90.0031.99512.27
5.3.80.0052.08112.13
5.3.70.0031.97211.97
5.3.60.0051.96012.22
5.3.50.0022.07712.16
5.3.40.1571.95212.10
5.3.30.0071.97512.24
5.3.20.0032.05411.95
5.3.10.0022.05411.87
5.3.00.0001.99911.88
5.2.170.0000.05011.24
5.2.160.0000.04011.24
5.2.150.0000.04011.24
5.2.140.0000.03011.24
5.2.130.0000.06311.24
5.2.120.0070.05711.24
5.2.110.0070.06011.24
5.2.100.0030.06011.24
5.2.90.0030.05711.24
5.2.80.0230.04011.24
5.2.70.0000.03711.24
5.2.60.0000.05011.24
5.2.50.0100.06011.24
5.2.40.0130.05311.24
5.2.30.0030.06311.24
5.2.20.0070.05711.24
5.2.10.0070.05711.24
5.2.00.0170.05011.24
5.1.60.0070.03711.24
5.1.50.0000.05311.24
5.1.40.0000.03011.24
5.1.30.0070.05711.24
5.1.20.0000.04011.24
5.1.10.0030.04711.24
5.1.00.0100.05011.24
5.0.50.0030.03711.24
5.0.40.0000.05011.24
5.0.30.0000.03711.24
5.0.20.0070.02711.24
5.0.10.0000.02711.24
5.0.00.0070.03011.24
4.4.90.0000.03311.24
4.4.80.0070.03311.24
4.4.70.0000.03011.24
4.4.60.0030.02711.24
4.4.50.0000.02311.24
4.4.40.0000.05711.24
4.4.30.0000.03311.24
4.4.20.0000.03711.24
4.4.10.0000.03011.24
4.4.00.0070.03011.24
4.3.110.0030.01311.24
4.3.100.0030.01311.24
4.3.90.0030.02011.24
4.3.80.0130.02711.24
4.3.70.0000.02011.24
4.3.60.0000.01711.24
4.3.50.0000.02711.24
4.3.40.0000.03011.24
4.3.30.0000.01711.24
4.3.20.0030.03711.24
4.3.10.0100.01311.24
4.3.00.0000.03311.24

preferences:
39.79 ms | 401 KiB | 5 Q