3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * A very edge case in PHP 5.4 regarding passing objects by reference. * It seems to be a compound effect of using reflection to set an inherited method as 'available', * AND that method taking an explicitly referential argument (&argument sig) * AND then invoking it with func_get_args() as opposed to constructing the array of args manually. * * No idea why these things all cause this behaviour or if they should. * * Important to note that this effect isn't present in PHP 5.5. */ class A { private function foo(&$arg1) { var_dump('arg1: ', $arg1); } } class B extends A { public function bar() { $x = new stdClass(); $x->baz = 'just a value'; $this->callPrivate($x); } private function callPrivate($x) { $method = new \ReflectionMethod( 'A', 'foo' ); //* for some reason, the private function needs to have been changed to be 'accessible' for this to work in 5.4 $method->setAccessible(true); //working 5.4 (* see above) but not in 5.5 $arguments = func_get_args(); //not working in either $arguments = array($x); // <---- COMMENT THIS LINE TO SEE IT WORK IN PHP 5.4 return $method->invokeArgs($this, $arguments); } } $y = new B(); $y->bar();

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.0150.00618.38
8.3.50.0130.00821.97
8.3.40.0120.00319.02
8.3.30.0120.00319.17
8.3.20.0060.00320.04
8.3.10.0030.00523.48
8.3.00.0030.00520.93
8.2.180.0110.00416.50
8.2.170.0070.00722.96
8.2.160.0070.01020.53
8.2.150.0070.01324.18
8.2.140.0080.00024.66
8.2.130.0070.00726.16
8.2.120.0100.00018.99
8.2.110.0030.00719.95
8.2.100.0120.00017.91
8.2.90.0040.00417.88
8.2.80.0080.00018.91
8.2.70.0080.00017.93
8.2.60.0050.00317.93
8.2.50.0040.00418.07
8.2.40.0030.00619.88
8.2.30.0040.00718.30
8.2.20.0040.00417.82
8.2.10.0080.00017.99
8.2.00.0030.00517.80
8.1.280.0160.00325.92
8.1.270.0030.00523.88
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0090.00023.86
8.1.230.0040.00822.63
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0050.00317.35
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0000.00818.57
8.1.160.0000.00822.02
8.1.150.0060.00318.70
8.1.140.0000.00817.44
8.1.130.0000.01017.84
8.1.120.0000.00717.51
8.1.110.0080.00017.43
8.1.100.0040.00417.53
8.1.90.0000.00717.48
8.1.80.0000.00817.38
8.1.70.0000.00817.41
8.1.60.0090.00317.42
8.1.50.0000.00817.44
8.1.40.0030.00617.39
8.1.30.0040.00417.72
8.1.20.0000.00717.66
8.1.10.0050.00317.48
8.1.00.0000.00817.59
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0050.00218.46
8.0.270.0040.00417.14
8.0.260.0000.00617.14
8.0.250.0000.00717.00
8.0.240.0040.00417.09
8.0.230.0030.00317.05
8.0.220.0000.00716.89
8.0.210.0030.00316.96
8.0.200.0000.00617.05
8.0.190.0000.00717.01
8.0.180.0050.00216.89
8.0.170.0030.00616.89
8.0.160.0040.00416.84
8.0.150.0000.00716.93
8.0.140.0070.00016.83
8.0.130.0050.00013.38
8.0.120.0050.00316.79
8.0.110.0000.00816.98
8.0.100.0040.00416.94
8.0.90.0080.00017.00
8.0.80.0060.00916.91
8.0.70.0040.00416.95
8.0.60.0030.00517.03
8.0.50.0040.00417.00
8.0.30.0100.00817.11
8.0.20.0050.01917.42
8.0.10.0080.00017.09
8.0.00.0060.01116.88
7.4.330.0020.00215.15
7.4.320.0030.00516.51
7.4.300.0030.00316.60
7.4.290.0080.00016.51
7.4.280.0070.00316.61
7.4.270.0080.00016.42
7.4.260.0070.00016.50
7.4.250.0050.00216.46
7.4.240.0020.00516.61
7.4.230.0000.00716.67
7.4.220.0130.00816.47
7.4.210.0030.01116.56
7.4.200.0040.00416.61
7.4.160.0040.01116.41
7.4.150.0000.02117.40
7.4.140.0100.00817.86
7.4.130.0100.00716.57
7.4.120.0080.00916.55
7.4.110.0180.00016.34
7.4.100.0170.00916.56
7.4.90.0090.01516.36
7.4.80.0060.01219.39
7.4.70.0070.01016.44
7.4.60.0110.00716.59
7.4.50.0000.00916.54
7.4.40.0170.00316.52
7.4.30.0030.01316.56
7.4.10.0090.00815.17
7.4.00.0070.00915.17
7.3.330.0000.00613.16
7.3.320.0070.00013.40
7.3.310.0000.00716.40
7.3.300.0070.00016.46
7.3.290.0000.01316.45
7.3.280.0140.00416.38
7.3.270.0160.00017.40
7.3.260.0150.00816.45
7.3.250.0060.01216.47
7.3.240.0100.00616.48
7.3.230.0100.00716.45
7.3.210.0130.01016.51
7.3.200.0100.01119.39
7.3.190.0120.00816.55
7.3.180.0090.00616.40
7.3.170.0060.01216.41
7.3.160.0120.00616.31
7.3.130.0070.01114.88
7.3.120.0040.01414.86
7.3.110.0050.01214.91
7.3.100.0070.00914.90
7.3.90.0020.01114.80
7.3.80.0050.00715.15
7.3.70.0070.00714.82
7.3.60.0020.01114.67
7.3.50.0090.00614.85
7.3.40.0020.00714.73
7.3.30.0070.00914.87
7.3.20.0070.00716.58
7.3.10.0070.01016.72
7.3.00.0060.00816.78
7.2.330.0090.00916.71
7.2.320.0120.01216.68
7.2.310.0060.00916.50
7.2.300.0030.01316.45
7.2.290.0140.00716.45
7.2.260.0020.01615.00
7.2.250.0090.00915.12
7.2.240.0040.01314.96
7.2.230.0060.01114.86
7.2.220.0070.00714.79
7.2.210.0050.00815.10
7.2.200.0080.00814.88
7.2.190.0020.01414.92
7.2.180.0060.00415.03
7.2.170.0080.00714.95
7.2.160.0070.00515.08
7.2.150.0100.00816.89
7.2.140.0100.00516.86
7.2.130.0070.00716.79
7.2.120.0040.00716.85
7.2.110.0050.01016.91
7.2.100.0110.00217.07
7.2.90.0070.01216.88
7.2.80.0080.00916.89
7.2.70.0050.00916.89
7.2.60.0030.00816.97
7.2.50.0050.00816.90
7.2.40.0030.00817.01
7.2.30.0100.00517.00
7.2.20.0080.00817.00
7.2.10.0050.00716.90
7.2.00.0080.00417.68
7.1.330.0050.00915.83
7.1.320.0090.00715.76
7.1.310.0100.00615.84
7.1.300.0060.00615.80
7.1.290.0040.00715.69
7.1.280.0060.00715.83
7.1.270.0060.00615.86
7.1.260.0040.01015.76
7.1.250.0070.00615.66
7.1.240.0060.00915.85
7.1.230.0060.00815.93
7.1.220.0030.01015.83
7.1.210.0100.00515.76
7.1.200.0070.00715.69
7.1.190.0030.00915.64
7.1.180.0060.00615.75
7.1.170.0090.00515.91
7.1.160.0070.00315.82
7.1.150.0030.01015.84
7.1.140.0110.00015.88
7.1.130.0030.00915.68
7.1.120.0030.00615.59
7.1.110.0020.00915.84
7.1.100.0100.00416.63
7.1.90.0020.00915.87
7.1.80.0070.00815.59
7.1.70.0040.01016.27
7.1.60.0050.01217.02
7.1.50.0070.01016.09
7.1.40.0070.00915.87
7.1.30.0080.00515.71
7.1.20.0030.01015.65
7.1.10.0050.00815.69
7.1.00.0070.02817.83
7.0.330.0040.00915.47
7.0.320.0040.01115.44
7.0.310.0090.00415.41
7.0.300.0050.01015.38
7.0.290.0020.00915.21
7.0.280.0060.01015.45
7.0.270.0070.00915.44
7.0.260.0010.01015.38
7.0.250.0040.00915.58
7.0.240.0020.01115.60
7.0.230.0050.00815.42
7.0.220.0060.00615.43
7.0.210.0060.00615.41
7.0.200.0040.00615.77
7.0.190.0060.00815.52
7.0.180.0030.00915.30
7.0.170.0030.01015.31
7.0.160.0030.01215.17
7.0.150.0020.01015.50
7.0.140.0020.03017.83
7.0.130.0080.00615.36
7.0.120.0050.00915.37
7.0.110.0200.03116.94
7.0.100.0230.01916.93
7.0.90.0250.02717.01
7.0.80.0210.03616.99
7.0.70.0210.02716.88
7.0.60.0180.03416.96
7.0.50.0260.02717.14
7.0.40.0030.03015.78
7.0.30.0060.03315.72
7.0.20.0050.03215.69
7.0.10.0110.02915.68
7.0.00.0080.03315.67
5.6.400.0090.00714.63
5.6.390.0060.00814.36
5.6.380.0060.00614.53
5.6.370.0060.00914.36
5.6.360.0020.01314.30
5.6.350.0040.00814.46
5.6.340.0120.00014.22
5.6.330.0030.01114.58
5.6.320.0050.01114.25
5.6.310.0060.00714.44
5.6.300.0040.00614.63
5.6.290.0030.01014.40
5.6.280.0020.03316.56
5.6.270.0020.00914.54
5.6.260.0020.00814.21
5.6.250.0060.03416.33
5.6.240.0090.03116.39
5.6.230.0030.03316.49
5.6.220.0050.01916.43
5.6.210.0080.03016.49
5.6.200.0070.03516.70
5.6.190.0100.03116.68
5.6.180.0060.03016.54
5.6.170.0060.02116.63
5.6.160.0120.02816.50
5.6.150.0100.02816.66
5.6.140.0120.02716.59
5.6.130.0110.02416.72
5.6.120.0040.03916.53
5.6.110.0040.03516.66
5.6.100.0080.03216.57
5.6.90.0070.02516.49
5.6.80.0070.02916.45
5.6.70.0080.03116.24
5.6.60.0120.02716.39
5.6.50.0040.03016.39
5.6.40.0030.02416.36
5.6.30.0060.02916.26
5.6.20.0030.02816.39
5.6.10.0030.03416.40
5.6.00.0070.03016.40
5.5.380.0040.03216.26
5.5.370.0080.03016.35
5.5.360.0070.03116.48
5.5.350.0010.02716.56
5.5.340.0080.02116.43
5.5.330.0050.03316.43
5.5.320.0090.03216.47
5.5.310.0070.03016.38
5.5.300.0050.03016.42
5.5.290.0080.02916.51
5.5.280.0070.03116.47
5.5.270.0050.02416.59
5.5.260.0050.03116.48
5.5.250.0100.02616.40
5.5.240.0080.01816.20
5.5.230.0020.03316.42
5.5.220.0040.03116.14
5.5.210.0100.02616.21
5.5.200.0090.02816.20
5.5.190.0100.02916.29
5.5.180.0070.02916.21
5.5.170.0110.00614.18
5.5.160.0110.03116.33
5.5.150.0040.02316.06
5.5.140.0050.03216.31
5.5.130.0060.03316.22
5.5.120.0040.02616.38
5.5.110.0030.03316.27
5.5.100.0110.02915.96
5.5.90.0070.03316.28
5.5.80.0080.03016.21
5.5.70.0030.02216.07
5.5.60.0090.02816.11
5.5.50.0130.02516.17
5.5.40.0080.02916.21
5.5.30.0040.01916.28
5.5.20.0090.02016.20
5.5.10.0060.01516.18
5.5.00.0060.03016.07
5.4.450.0060.02914.42
5.4.440.0090.02514.35
5.4.430.0030.03014.45
5.4.420.0050.03114.34
5.4.410.0030.03014.29
5.4.400.0050.02614.31
5.4.390.0050.03014.30
5.4.380.0090.02514.21
5.4.370.0120.01314.29
5.4.360.0050.01914.21
5.4.350.0080.02514.33
5.4.340.0030.03014.23
5.4.330.0060.00211.84
5.4.320.0020.02214.30
5.4.310.0040.02914.23
5.4.300.0070.01714.30
5.4.290.0080.02214.34
5.4.280.0040.03114.25
5.4.270.0060.02514.34
5.4.260.0040.03214.29
5.4.250.0060.01714.27
5.4.240.0100.02414.28
5.4.230.0060.02914.29
5.4.220.0040.02914.28
5.4.210.0040.02714.30
5.4.200.0060.01514.30
5.4.190.0060.02914.30
5.4.180.0040.02414.23
5.4.170.0030.02814.30
5.4.160.0040.02814.27
5.4.150.0050.03114.22
5.4.140.0040.02413.34
5.4.130.0070.02213.41
5.4.120.0050.03013.45
5.4.110.0070.02413.44
5.4.100.0030.02613.37
5.4.90.0060.03013.38
5.4.80.0040.03113.42
5.4.70.0060.01713.40
5.4.60.0080.02213.32
5.4.50.0090.02313.32
5.4.40.0050.02813.35
5.4.30.0050.02913.38
5.4.20.0070.02413.36
5.4.10.0030.02413.40
5.4.00.0080.02613.22
5.3.290.0080.02612.79
5.3.280.0060.02712.72
5.3.270.0070.02412.77
5.3.260.0060.02812.81
5.3.250.0010.03312.84
5.3.240.0040.02212.79
5.3.230.0030.02912.79
5.3.220.0030.02412.74
5.3.210.0050.03112.83
5.3.200.0050.02012.75
5.3.190.0080.02012.76
5.3.180.0030.02212.75
5.3.170.0040.02712.74
5.3.160.0060.02412.76
5.3.150.0040.01812.75
5.3.140.0040.02712.74
5.3.130.0050.02212.82
5.3.120.0080.02012.75
5.3.110.0010.03012.70
5.3.100.0020.03112.58
5.3.90.0050.02712.62
5.3.80.0030.03012.61
5.3.70.0020.02912.57
5.3.60.0040.03012.57
5.3.50.0050.02612.53
5.3.40.0070.02412.55
5.3.30.0090.02312.53
5.3.20.0060.01912.47
5.3.10.0080.01312.48
5.3.00.0030.01712.46
5.2.170.0070.06011.29
5.2.160.0070.05711.15
5.2.150.0000.04311.38
5.2.140.0000.04011.12
5.2.130.0030.02711.26
5.2.120.0100.06011.26
5.2.110.0030.03311.09
5.2.100.0030.02711.12
5.2.90.0070.02311.17
5.2.80.0070.02711.10
5.2.70.0000.03011.16
5.2.60.0070.03011.07
5.2.50.0000.03011.03
5.2.40.0030.02710.86
5.2.30.0000.03011.05
5.2.20.0100.02011.05
5.2.10.0030.04310.95
5.2.00.0100.03710.96
5.1.60.0000.0239.98
5.1.50.0000.02710.00
5.1.40.0100.03710.06
5.1.30.0030.02310.58
5.1.20.0000.02710.38
5.1.10.0070.04710.27
5.1.00.0070.02710.16
5.0.50.0000.0238.55
5.0.40.0000.0278.39
5.0.30.0030.0278.35
5.0.20.0030.0338.35
5.0.10.0000.0278.35
5.0.00.0000.0308.35
4.4.90.0030.0138.35
4.4.80.0000.0178.35
4.4.70.0000.0278.35
4.4.60.0000.0178.35
4.4.50.0030.0208.35
4.4.40.0030.0338.35
4.4.30.0000.0208.35
4.4.20.0000.0338.35
4.4.10.0030.0138.35
4.4.00.0030.0408.35
4.3.110.0000.0138.35
4.3.100.0030.0278.35
4.3.90.0000.0238.35
4.3.80.0000.0238.35
4.3.70.0000.0178.35
4.3.60.0000.0138.35
4.3.50.0000.0178.35
4.3.40.0000.0378.35
4.3.30.0030.0138.35
4.3.20.0000.0178.35
4.3.10.0000.0138.35
4.3.00.0000.0138.35

preferences:
60.46 ms | 401 KiB | 5 Q