3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container { protected $target; protected $className; protected $methods = array(); public function __construct( $target ) { $this->target = $target; } public function attach( $name, $method ) { if ( !$this->className ) { $this->className = get_class( $this->target ); } $binded = Closure::bind( $method, $this->target, $this->className ); $this->methods[$name] = $binded; } public function __call( $name, $arguments ) { if ( array_key_exists( $name, $this->methods ) ) { return call_user_func_array( $this->methods[$name] , $arguments ); } if ( method_exists( $this->target, $name ) ) { return call_user_func_array( array( $this->target, $name ), $arguments ); } } } class Foo { private $bar = 'payload'; }; $foobar = new Foo; // you initial object $instance = new Container( $foobar ); $func = function ( $param ) { return 'Get ' . $this->bar . ' and ' . $param; }; $instance->attach('test', $func); // setting up the whole thing echo $instance->test('lorem ipsum'); // 'Get payload and lorem ipsum'

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.0070.00718.30
8.3.50.0110.00622.05
8.3.40.0110.00718.96
8.3.30.0070.00719.00
8.3.20.0000.00818.90
8.3.10.0080.00021.04
8.3.00.0080.00023.66
8.2.180.0190.00018.41
8.2.170.0150.00022.96
8.2.160.0030.01020.53
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.06
8.2.110.0000.01020.38
8.2.100.0090.00317.72
8.2.90.0000.00819.22
8.2.80.0000.00817.97
8.2.70.0000.00917.63
8.2.60.0040.00417.93
8.2.50.0050.00318.07
8.2.40.0030.00518.16
8.2.30.0030.00619.79
8.2.20.0040.00417.82
8.2.10.0040.00417.79
8.2.00.0080.00017.69
8.1.280.0140.00025.92
8.1.270.0040.00423.99
8.1.260.0090.00926.35
8.1.250.0000.00828.09
8.1.240.0040.00422.61
8.1.230.0040.00720.98
8.1.220.0060.00318.77
8.1.210.0040.00418.96
8.1.200.0030.00717.35
8.1.190.0060.00317.64
8.1.180.0050.00318.10
8.1.170.0060.00318.56
8.1.160.0000.00818.93
8.1.150.0040.00418.59
8.1.140.0040.00417.54
8.1.130.0030.00317.78
8.1.120.0000.00717.55
8.1.110.0030.00717.55
8.1.100.0020.00517.48
8.1.90.0040.00417.41
8.1.80.0040.00317.48
8.1.70.0000.00817.42
8.1.60.0000.00817.68
8.1.50.0040.00417.40
8.1.40.0000.00717.58
8.1.30.0030.00517.58
8.1.20.0050.00317.63
8.1.10.0000.00817.63
8.1.00.0040.00417.43
8.0.300.0000.00720.11
8.0.290.0040.00417.28
8.0.280.0050.00318.42
8.0.270.0070.00017.30
8.0.260.0000.00616.86
8.0.250.0080.00017.05
8.0.240.0030.00717.02
8.0.230.0040.00416.93
8.0.220.0070.00016.86
8.0.210.0070.00016.86
8.0.200.0030.00316.89
8.0.190.0050.00217.02
8.0.180.0060.00616.84
8.0.170.0030.00616.84
8.0.160.0070.00016.98
8.0.150.0030.00616.78
8.0.140.0100.00016.80
8.0.130.0000.00613.34
8.0.120.0000.00716.86
8.0.110.0030.00516.74
8.0.100.0040.00416.78
8.0.90.0050.00216.96
8.0.80.0070.01416.86
8.0.70.0030.00516.98
8.0.60.0050.00216.88
8.0.50.0050.00216.73
8.0.30.0160.00917.14
8.0.20.0110.00817.40
8.0.10.0000.00716.93
8.0.00.0160.01316.79
7.4.330.0000.00514.68
7.4.320.0000.00716.45
7.4.300.0000.00716.68
7.4.290.0030.00316.64
7.4.280.0000.01116.64
7.4.270.0040.00416.45
7.4.260.0060.00013.34
7.4.250.0040.00416.50
7.4.240.0030.00316.66
7.4.230.0080.00016.70
7.4.220.0100.00516.50
7.4.210.0070.00916.57
7.4.200.0030.00316.73
7.4.190.0040.00416.66
7.4.160.0080.01616.35
7.4.150.0030.01417.40
7.4.140.0120.00617.86
7.4.130.0030.01316.53
7.4.120.0070.01016.52
7.4.110.0060.01216.68
7.4.100.0080.00816.60
7.4.90.0060.01216.71
7.4.80.0060.01219.37
7.4.70.0060.01016.55
7.4.60.0030.01316.43
7.4.50.0040.00416.62
7.4.40.0030.01022.27
7.4.30.0030.01416.58
7.4.00.0070.01015.17
7.3.330.0000.00513.34
7.3.320.0000.00513.22
7.3.310.0000.00716.40
7.3.300.0040.00416.41
7.3.290.0110.00316.34
7.3.280.0090.00716.31
7.3.270.0070.01017.40
7.3.260.0070.01118.24
7.3.250.0130.00616.32
7.3.240.0110.01216.38
7.3.230.0060.01116.61
7.3.210.0040.01616.59
7.3.200.0040.01519.39
7.3.190.0070.01316.44
7.3.180.0040.01316.53
7.3.170.0080.00816.31
7.3.160.0090.00616.32
7.3.120.0080.01015.01
7.3.110.0060.01314.88
7.3.100.0100.01015.14
7.3.90.0060.01014.79
7.3.80.0030.00715.11
7.3.70.0120.00314.88
7.3.60.0110.00314.81
7.3.50.0030.01214.86
7.3.40.0050.00514.62
7.3.30.0040.01114.76
7.3.20.0040.01116.72
7.3.10.0030.01016.27
7.3.00.0040.00816.50
7.2.330.0060.01216.62
7.2.320.0170.00616.71
7.2.310.0060.01216.81
7.2.300.0090.00916.59
7.2.290.0040.01216.82
7.2.250.0110.00714.61
7.2.240.0030.01515.21
7.2.230.0030.01215.09
7.2.220.0060.01115.09
7.2.210.0120.00315.19
7.2.200.0110.00015.23
7.2.190.0070.01015.26
7.2.180.0000.01514.86
7.2.170.0060.01215.09
7.2.160.0060.00914.78
7.2.150.0000.01517.04
7.2.140.0110.00416.94
7.2.130.0060.00917.11
7.2.120.0030.01016.88
7.2.110.0100.00316.80
7.2.100.0070.01017.06
7.2.90.0100.00317.13
7.2.80.0000.01616.93
7.2.70.0080.00316.90
7.2.60.0070.01017.04
7.2.50.0070.00716.98
7.2.40.0030.01316.57
7.2.30.0000.01617.15
7.2.20.0030.00916.96
7.2.10.0060.00916.63
7.2.00.0060.00618.23
7.1.330.0080.00915.83
7.1.320.0000.01115.84
7.1.310.0030.01215.77
7.1.300.0070.00715.83
7.1.290.0070.00715.59
7.1.280.0070.00715.91
7.1.270.0030.01215.85
7.1.260.0070.00415.89
7.1.250.0070.01015.79
7.1.240.0000.01615.72
7.1.230.0060.00815.97
7.1.220.0090.00615.75
7.1.210.0030.01315.97
7.1.200.0060.00315.95
7.1.190.0000.01016.00
7.1.180.0040.01215.83
7.1.170.0090.00415.61
7.1.160.0000.01515.74
7.1.150.0000.00915.90
7.1.140.0050.00515.75
7.1.130.0070.00315.71
7.1.120.0110.00415.55
7.1.110.0100.00016.03
7.1.100.0060.00516.78
7.1.90.0040.01115.71
7.1.80.0030.00615.90
7.1.70.0020.00616.46
7.1.60.0120.00717.63
7.1.50.0080.00916.47
7.1.40.0070.00315.90
7.1.30.0060.00915.80
7.1.20.0030.01015.60
7.1.10.0100.00315.46
7.1.00.0020.03819.09
7.0.330.0040.00715.33
7.0.320.0110.00415.22
7.0.310.0040.00715.43
7.0.300.0060.00615.37
7.0.290.0030.01015.41
7.0.280.0040.00415.45
7.0.270.0030.01015.62
7.0.260.0060.00615.55
7.0.250.0070.00715.51
7.0.240.0030.00715.55
7.0.230.0070.00415.50
7.0.220.0090.00315.24
7.0.210.0130.00015.45
7.0.200.0030.00616.16
7.0.190.0040.01115.54
7.0.180.0030.01015.22
7.0.170.0030.00715.58
7.0.160.0070.00715.22
7.0.150.0000.01315.45
7.0.140.0030.03818.71
7.0.130.0030.01015.58
7.0.120.0080.00815.24
7.0.110.0040.01115.31
7.0.100.0070.00315.60
7.0.90.0060.00315.55
7.0.80.0080.00415.41
7.0.70.0060.00615.46
7.0.60.0080.04217.78
7.0.50.0060.02316.73
7.0.40.0060.02815.65
7.0.30.0030.04315.65
7.0.20.0050.02715.46
7.0.10.0030.04515.49
7.0.00.0100.02015.70
5.6.400.0040.00814.71
5.6.390.0030.01414.30
5.6.380.0040.01114.64
5.6.370.0080.00414.76
5.6.360.0070.01014.75
5.6.350.0060.01014.62
5.6.340.0100.00014.32
5.6.330.0030.01014.43
5.6.320.0040.00714.73
5.6.310.0030.00914.63
5.6.300.0030.00614.72
5.6.290.0030.00614.49
5.6.280.0080.03617.75
5.6.270.0060.01014.46
5.6.260.0100.00614.33
5.6.250.0120.00314.52
5.6.240.0060.00914.44
5.6.230.0060.00314.46
5.6.220.0000.01514.29
5.6.210.0040.02617.65
5.6.200.0070.02216.34
5.6.190.0090.01916.39
5.6.180.0050.02516.20
5.6.170.0100.02716.34
5.6.160.0070.02816.33
5.6.150.0080.04216.20
5.6.140.0050.02516.37
5.6.130.0030.03516.38
5.6.120.0090.04216.30
5.6.110.0080.04316.30
5.6.100.0060.02816.43
5.6.90.0050.02716.40
5.6.80.0070.03915.92
5.6.70.0090.02715.99
5.6.60.0050.02515.96
5.6.50.0020.03115.89
5.6.40.0050.03915.93
5.6.30.0100.03815.94
5.6.20.0080.04015.92
5.6.10.0130.03016.04
5.6.00.0050.04515.94
5.5.380.0100.00314.11
5.5.370.0030.00514.32
5.5.360.0060.01214.21
5.5.350.0180.03717.41
5.5.340.0030.03116.20
5.5.330.0080.02016.24
5.5.320.0060.02116.03
5.5.310.0080.04016.31
5.5.300.0120.02316.34
5.5.290.0020.02816.20
5.5.280.0070.04516.20
5.5.270.0040.04916.14
5.5.260.0020.03316.26
5.5.250.0100.02416.18
5.5.240.0100.04316.00
5.5.230.0050.03015.84
5.5.220.0120.01715.71
5.5.210.0100.03515.93
5.5.200.0080.03915.98
5.5.190.0080.04015.79
5.5.180.0050.04215.91
5.5.170.0030.00614.50
5.5.160.0090.02315.80
5.5.150.0090.02816.01
5.5.140.0070.04515.81
5.5.130.0020.03115.86
5.5.120.0080.04215.75
5.5.110.0050.03815.98
5.5.100.0030.02815.82
5.5.90.0020.04615.93
5.5.80.0030.03815.91
5.5.70.0120.04015.75
5.5.60.0100.01815.84
5.5.50.0070.04015.79
5.5.40.0020.02615.79
5.5.30.0060.02815.88
5.5.20.0050.02715.87
5.5.10.0070.03915.77
5.5.00.0030.02815.81
5.4.450.0050.04715.52
5.4.440.0050.04515.52
5.4.430.0040.03815.59
5.4.420.0050.02615.47
5.4.410.0100.02215.42
5.4.400.0030.04215.32
5.4.390.0050.04015.31
5.4.380.0050.02515.37
5.4.370.0070.03915.33
5.4.360.0050.04215.36
5.4.350.0030.04415.32
5.4.340.0030.02715.32
5.4.330.0000.00611.59
5.4.320.0110.03615.36
5.4.310.0050.03215.33
5.4.300.0100.03515.35
5.4.290.0100.03315.34
5.4.280.0070.03315.31
5.4.270.0050.03715.30
5.4.260.0080.03315.36
5.4.250.0060.03815.31
5.4.240.0060.02115.36
5.4.230.0030.03415.27
5.4.220.0030.04315.32
5.4.210.0070.04015.36
5.4.200.0080.03815.36
5.4.190.0050.04715.36
5.4.180.0030.02215.30
5.4.170.0050.02515.34
5.4.160.0020.03715.35
5.4.150.0020.04215.23
5.4.140.0040.02814.06
5.4.130.0020.02514.02
5.4.120.0060.03013.98
5.4.110.0070.03914.12
5.4.100.0100.03714.06
5.4.90.0060.03914.06
5.4.80.0120.03514.02
5.4.70.0080.03314.05
5.4.60.0010.03814.01
5.4.50.0050.03914.01
5.4.40.0060.03814.10
5.4.30.0050.03014.00
5.4.20.0040.04113.98
5.4.10.0130.02313.98
5.4.00.0050.03213.66
5.3.290.0090.03113.17
5.3.280.0070.02813.21
5.3.270.0120.03313.04
5.3.260.0060.04313.13
5.3.250.0050.03813.12
5.3.240.0070.02713.16
5.3.230.0030.03513.13
5.3.220.0060.03313.12
5.3.210.0050.03513.07
5.3.200.0110.03613.07
5.3.190.0050.03813.11
5.3.180.0030.04113.01
5.3.170.0060.03813.12
5.3.160.0050.03113.01
5.3.150.0000.02613.02
5.3.140.0070.04013.06
5.3.130.0000.02813.12
5.3.120.0080.03613.09
5.3.110.0050.03813.18
5.3.100.0060.02312.84
5.3.90.0050.04012.84
5.3.80.0080.03712.92
5.3.70.0050.03712.76
5.3.60.0020.03512.75
5.3.50.0030.04312.72
5.3.40.0050.03412.88
5.3.30.0060.03812.79
5.3.20.0050.02412.65
5.3.10.0070.03312.57
5.3.00.0040.02512.72
5.2.170.0100.04711.15
5.2.160.0100.03711.00
5.2.150.0000.04311.12
5.2.140.0030.04711.05
5.2.130.0070.02711.15
5.2.120.0100.05311.01
5.2.110.0030.03011.13
5.2.100.0030.04011.16
5.2.90.0030.06311.16
5.2.80.0030.06011.09
5.2.70.0100.05711.20
5.2.60.0070.06010.96
5.2.50.0100.04011.07
5.2.40.0070.05011.05
5.2.30.0030.06011.04
5.2.20.0070.05710.96
5.2.10.0070.06010.71
5.2.00.0030.06010.79
5.1.60.0100.0379.98
5.1.50.0030.05010.04
5.1.40.0070.04710.05
5.1.30.0070.03710.33
5.1.20.0100.03710.21
5.1.10.0030.05710.16
5.1.00.0000.06010.03
5.0.50.0030.0478.61
5.0.40.0030.0438.39
5.0.30.0030.0538.45
5.0.20.0030.0238.27
5.0.10.0070.0378.18
5.0.00.0000.0638.27
4.4.90.0100.0237.69
4.4.80.0100.0277.73
4.4.70.0000.0307.73
4.4.60.0030.0377.73
4.4.50.0000.0307.73
4.4.40.0000.0307.73
4.4.30.0000.0377.73
4.4.20.0030.0307.73
4.4.10.0000.0277.73
4.4.00.0000.0577.73
4.3.110.0030.0337.73
4.3.100.0000.0237.73
4.3.90.0000.0207.73
4.3.80.0070.0237.73
4.3.70.0030.0337.73
4.3.60.0000.0307.73
4.3.50.0000.0237.73
4.3.40.0000.0307.73
4.3.30.0000.0277.73
4.3.20.0030.0307.73
4.3.10.0000.0277.73
4.3.00.0000.0277.73

preferences:
34.09 ms | 401 KiB | 5 Q