3v4l.org

run code in 300+ PHP versions simultaneously
<?php class abc { function abc() { $this->abc = 'Hello'; } function bcd() { $bcd = ' World'; return $this->abc . $bcd; } } $abc = new abc(); echo $abc->bcd(); $bcd = range( 1, 100 ); foreach( $bcd as $def ) { $efg = $def; } function better_array_diff($a, $b) { $map = array(); foreach($a as $val) $map[$val] = 1; foreach($b as $val) if(isset($map[$val])) unset($map[$val]); return $map; } $a = range(1, 10000); $b = range(5000, 15000); shuffle($a); shuffle($b); $ts = microtime(true); array_diff($a, $b); printf("array_diff=%.4f\n", microtime(true) - $ts); $ts = microtime(true); better_array_diff($a, $b); printf("better_array_diff=%.4f\n", microtime(true) - $ts);

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.0030.01021.34
7.1.70.0000.01219.18
7.1.60.0150.01519.40
7.1.50.0080.01918.80
7.1.00.0070.07724.34
7.0.200.0820.00916.73
7.0.140.0070.07324.15
7.0.100.0070.04721.83
7.0.90.0030.09021.82
7.0.80.0270.08321.82
7.0.70.0470.07721.70
7.0.60.0130.06321.84
7.0.50.0200.08722.02
7.0.40.0030.04720.04
7.0.30.0000.06020.06
7.0.20.0070.04320.00
7.0.10.0070.05020.08
7.0.00.0030.04320.05
5.6.280.0000.15726.25
5.6.250.0130.10025.86
5.6.240.0070.15325.70
5.6.230.0200.15325.61
5.6.220.0070.14725.69
5.6.210.0170.14325.76
5.6.200.0030.14326.14
5.6.190.0130.14026.25
5.6.180.0070.09726.15
5.6.170.0030.10326.24
5.6.160.0030.11326.06
5.6.150.0000.09026.21
5.6.140.0100.10026.19
5.6.130.0030.10026.19
5.6.120.0070.10726.04
5.6.110.0100.10026.21
5.6.100.0070.10026.06
5.6.90.0270.07726.11
5.6.80.0030.10325.54
5.6.70.0000.10025.53
5.6.60.0070.11025.43
5.6.50.0070.09325.59
5.6.40.0100.09325.51
5.6.30.0100.10325.41
5.6.20.0100.15325.46
5.6.10.0130.14025.57
5.6.00.0130.15725.51
5.5.380.0070.13725.53
5.5.370.0100.16325.47
5.5.360.0000.12025.52
5.5.350.0170.14725.45
5.5.340.0100.16025.91
5.5.330.0130.15325.93
5.5.320.0170.12025.96
5.5.310.0070.08025.91
5.5.300.0070.15026.03
5.5.290.0070.14325.92
5.5.280.0030.10725.75
5.5.270.0100.12025.98
5.5.260.0070.11025.89
5.5.250.0030.11725.80
5.5.240.0000.11725.32
5.5.230.0130.09325.38
5.5.220.0030.10025.39
5.5.210.0100.09725.28
5.5.200.0100.11725.32
5.5.190.0200.13325.29
5.5.180.0100.09725.29
5.5.160.0070.11025.23
5.5.150.0030.12025.38
5.5.140.0270.13025.25
5.5.130.0100.14725.19
5.5.120.0100.15325.32
5.5.110.0130.17725.25
5.5.100.0070.15325.27
5.5.90.0030.15725.17
5.5.80.0070.14025.29
5.5.70.0100.11025.27
5.5.60.0100.12025.27
5.5.50.0130.14325.07
5.5.40.0170.13325.07
5.5.30.0070.13725.30
5.5.20.0070.09025.04
5.5.10.0070.14025.14
5.5.00.0170.13025.19
5.4.450.0130.10324.45
5.4.440.0100.10024.50
5.4.430.0030.11724.31
5.4.420.0070.09324.59
5.4.410.0070.11024.41
5.4.400.0030.10024.12
5.4.390.0000.08024.12
5.4.380.0070.10024.04
5.4.370.0100.09324.11
5.4.360.0070.06724.27
5.4.350.0070.18023.95
5.4.340.0170.13324.14
5.4.320.0170.13024.03
5.4.310.0100.14724.21
5.4.300.0100.13024.16
5.4.290.0030.11723.98
5.4.280.0200.12024.08
5.4.270.0200.12724.04
5.4.260.0030.18024.18
5.4.250.0230.13024.20
5.4.240.0030.15724.19
5.4.230.0200.13024.10
5.4.220.0100.14024.26
5.4.210.0130.12324.14
5.4.200.0230.14724.18
5.4.190.0100.12323.94
5.4.180.0130.15723.93
5.4.170.0130.16324.30
5.4.160.0070.14324.19
5.4.150.0170.13724.08
5.4.140.0170.14321.54
5.4.130.0170.14021.49
5.4.120.0070.14721.52
5.4.110.0100.15021.42
5.4.100.0130.14021.63
5.4.90.0030.15021.60
5.4.80.0100.15721.41
5.4.70.0070.16021.41
5.4.60.0170.14321.43
5.4.50.0100.09321.48
5.4.40.0100.13721.46
5.4.30.0130.13721.60
5.4.20.0070.18321.46
5.4.10.0100.13321.55
5.4.00.0130.15020.94
5.3.290.0130.17319.63
5.3.280.0100.13019.68
5.3.270.0000.11019.65
5.3.260.0100.13019.74
5.3.250.0200.13319.71
5.3.240.0170.14719.79
5.3.230.0100.16019.76
5.3.220.0070.17019.68
5.3.210.0130.11019.75
5.3.200.0130.13019.72
5.3.190.0000.15719.78
5.3.180.0100.15019.61
5.3.170.0070.14719.60
5.3.160.0130.12719.68
5.3.150.0100.14719.64
5.3.140.0070.09719.67
5.3.130.0200.16319.55
5.3.120.0200.17319.70
5.3.110.0030.16019.55
5.3.100.0170.15019.17
5.3.90.0130.16019.11
5.3.80.0100.14019.00
5.3.70.0000.12719.12
5.3.60.0130.13319.19
5.3.50.0070.11718.98
5.3.40.0170.15718.93
5.3.30.0202.41017.71
5.3.20.0232.41017.54
5.3.10.0102.43017.34
5.3.00.0172.42717.43
5.2.170.0070.12715.68
5.2.160.0070.14015.80
5.2.150.0030.14015.86
5.2.140.0372.37014.83
5.2.130.0172.42314.67
5.2.120.0332.44014.75
5.2.110.0132.44014.77
5.2.100.0272.43014.78
5.2.90.0102.43014.68
5.2.80.0132.42014.61
5.2.70.0232.41314.79
5.2.60.0272.37314.68
5.2.50.0130.08015.58
5.2.40.0030.09315.64
5.2.30.0030.09014.87
5.2.20.0000.09314.88
5.2.10.0000.15014.42
5.2.00.0030.14716.40
5.1.60.0030.12717.54
5.1.50.0100.12717.63
5.1.40.0070.12717.38
5.1.30.0070.10717.80
5.1.20.0030.13317.86
5.1.10.0070.14017.49
5.1.00.0070.11717.69
5.0.50.0000.12716.13
5.0.40.0030.12316.04
5.0.30.0000.16715.70
5.0.20.0100.12715.89
5.0.10.0000.15015.65
5.0.00.0000.20015.84
4.4.90.0030.18313.52
4.4.80.0000.09313.58
4.4.70.0000.12013.57
4.4.60.0000.12313.52
4.4.50.0000.10713.50
4.4.40.0070.12313.57
4.4.30.0030.10013.46
4.4.20.0000.12313.53
4.4.10.0000.12313.64
4.4.00.0000.11713.53
4.3.110.0000.13313.44
4.3.100.0100.12713.40
4.3.90.0070.13313.34
4.3.80.0030.15713.57
4.3.70.0000.17013.43
4.3.60.0030.17013.36
4.3.50.0070.17013.40
4.3.40.0130.19013.39
4.3.30.0030.17012.21
4.3.20.0000.18012.20
4.3.10.0030.12712.10
4.3.00.0030.17012.06

preferences:
31.73 ms | 400 KiB | 5 Q