3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Reduced core class from MediaWiki to demonstrate an issue starting with 7.1.0alpha2 // https://github.com/wikimedia/mediawiki/blob/master/includes/Hooks.php class Hooks { protected static $handlers = array(); public static function register( $name, $callback ) { if ( !isset( self::$handlers[$name] ) ) { self::$handlers[$name] = array(); } self::$handlers[$name][] = $callback; } public static function run( $event, array $args = array() ) { foreach ( self::$handlers[$event] as $hook ) { if ( !is_array( $hook ) ) { $hook = array( $hook ); } if ( !array_filter( $hook ) ) { continue; } elseif ( is_array( $hook[0] ) ) { $hook = array_merge( $hook[0], array_slice( $hook, 1 ) ); } if ( $hook[0] instanceof Closure ) { $func = "hook-$event-closure"; $callback = array_shift( $hook ); } elseif ( is_object( $hook[0] ) ) { $object = array_shift( $hook ); $method = array_shift( $hook ); if ( $method === null ) { $method = "on$event"; } $func = get_class( $object ) . '::' . $method; $callback = array( $object, $method ); } elseif ( is_string( $hook[0] ) ) { $func = $callback = array_shift( $hook ); } $retval = null; $badhookmsg = null; $hook_args = array_merge( $hook, $args ); $retval = call_user_func_array( $callback, $args ); } } } Hooks::register( 'foo', function( &$foo, &$var ) { $var = $var . '-bar'; } ); //Stub class using &$this as direct reference class Foo { public function doSomething( $var ) { Hooks::run( 'foo', array( &$this, &$var ) ); return $var; } } // Stub class causes no error after $this is being redeclared class Foo2 { public function doSomething( $var ) { $foo = $this; Hooks::run( 'foo', array( &$foo, &$var ) ); return $var; } } // Causes an error $fooA = new Foo(); $varA = $fooA->doSomething( '123' ); echo "Foo: \n"; echo $varA . "\n"; // Causes no error $fooB = new Foo2(); $varB = $fooB->doSomething( '123' ); echo "Foo2: \n"; echo $varB;

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.4.120.0120.00824.01
8.4.110.0140.00618.96
8.4.100.0100.00617.76
8.4.90.0140.00518.50
8.4.80.0140.00619.64
8.4.70.0090.00518.01
8.4.60.0100.01018.80
8.4.50.0110.01120.23
8.4.40.0090.00923.76
8.4.30.0090.00622.30
8.4.20.0200.00017.69
8.4.10.0050.00519.45
8.3.250.0090.00919.08
8.3.240.0130.00716.33
8.3.230.0100.01016.75
8.3.220.0130.00517.24
8.3.210.0110.00821.02
8.3.200.0030.00616.68
8.3.190.0080.01017.26
8.3.180.0080.00818.53
8.3.170.0070.01117.10
8.3.160.0150.00318.26
8.3.150.0090.00918.29
8.3.140.0000.00817.19
8.3.130.0030.00616.66
8.3.120.0000.00818.79
8.3.110.0050.00320.94
8.3.100.0060.00324.06
8.3.90.0060.01326.77
8.3.80.0040.00417.97
8.3.70.0110.01116.50
8.3.60.0090.00618.53
8.3.50.0090.01122.90
8.3.40.0030.01618.72
8.3.30.0110.00418.89
8.3.20.0040.00420.21
8.3.10.0040.00421.73
8.3.00.0040.00419.66
8.2.290.0100.00620.32
8.2.280.0110.00818.49
8.2.270.0150.00417.09
8.2.260.0080.00016.66
8.2.250.0180.00016.68
8.2.240.0000.00817.25
8.2.230.0030.00622.58
8.2.220.0110.00737.54
8.2.210.0060.01326.77
8.2.200.0000.01018.16
8.2.190.0040.01618.16
8.2.180.0110.00418.26
8.2.170.0150.00022.96
8.2.160.0040.01119.23
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0060.00318.75
8.2.110.0060.00320.53
8.2.100.0040.00817.97
8.2.90.0050.00317.63
8.2.80.0000.00818.91
8.2.70.0050.00317.50
8.2.60.0080.00017.75
8.2.50.0080.00017.55
8.2.40.0030.00619.78
8.2.30.0040.00420.97
8.2.20.0000.00717.81
8.2.10.0020.00518.19
8.2.00.0050.00218.20
8.1.330.0120.00721.99
8.1.320.0110.01016.23
8.1.310.0000.00718.45
8.1.300.0040.00418.48
8.1.290.0030.00630.84
8.1.280.0040.01125.92
8.1.270.0050.00323.91
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00320.65
8.1.230.0000.01221.97
8.1.220.0080.00018.51
8.1.210.0000.00818.77
8.1.200.0120.00017.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0040.00417.62
8.1.160.0000.00722.14
8.1.150.0040.00420.59
8.1.140.0040.00419.50
8.1.130.0000.00717.71
8.1.120.0040.00317.48
8.1.110.0060.00317.46
8.1.100.0000.00717.48
8.1.90.0080.00017.42
8.1.80.0070.00017.35
8.1.70.0040.00417.48
8.1.60.0000.00917.58
8.1.50.0060.00317.46
8.1.40.0090.00317.41
8.1.30.0040.00417.52
8.1.20.0050.00317.57
8.1.10.0030.00617.52
8.1.00.0060.00317.59
8.0.300.0000.00819.90
8.0.290.0080.00016.75
8.0.280.0050.00218.48
8.0.270.0000.00717.25
8.0.260.0030.00317.25
8.0.250.0030.00316.87
8.0.240.0040.00416.95
8.0.230.0050.00316.97
8.0.220.0000.00716.91
8.0.210.0080.00016.85
8.0.200.0040.00416.95
8.0.190.0000.00716.98
8.0.180.0040.00416.84
8.0.170.0040.00416.82
8.0.160.0000.00816.96
8.0.150.0000.00716.95
8.0.140.0030.00616.76
8.0.130.0000.00613.29
8.0.120.0000.00816.89
8.0.110.0060.00316.94
8.0.100.0040.00416.91
8.0.90.0030.00616.91
8.0.80.0080.00816.86
8.0.70.0000.00716.86
8.0.60.0040.00416.75
8.0.50.0040.00416.77
8.0.30.0090.00717.18
8.0.20.0120.01017.40
8.0.10.0000.00816.84
8.0.00.0100.00616.55
7.4.330.0020.00215.16
7.4.320.0030.00316.50
7.4.300.0040.00416.59
7.4.290.0200.00416.62
7.4.280.0030.00616.52
7.4.270.0030.00316.37
7.4.260.0000.00716.59
7.4.250.0070.00016.56
7.4.240.0000.00716.54
7.4.230.0040.00416.51
7.4.220.0070.00016.50
7.4.210.0170.00316.48
7.4.200.0070.00016.50
7.4.160.0100.00616.64
7.4.150.0090.00917.40
7.4.140.0100.01117.86
7.4.130.0090.00916.52
7.4.120.0080.00916.57
7.4.110.0030.01316.31
7.4.100.0090.00916.41
7.4.90.0090.00916.68
7.4.80.0070.01019.39
7.4.70.0000.01816.49
7.4.60.0060.01016.42
7.4.50.0070.01016.44
7.4.40.0090.00916.35
7.4.30.0030.01316.46
7.4.00.0140.00414.90
7.3.330.0000.00613.34
7.3.320.0000.00513.33
7.3.310.0050.00316.27
7.3.300.0000.00716.32
7.3.290.0110.00616.35
7.3.280.0110.00716.35
7.3.270.0120.00817.40
7.3.260.0060.01116.51
7.3.250.0100.00916.45
7.3.240.0080.01016.49
7.3.230.0070.01116.46
7.3.210.0060.01016.30
7.3.200.0060.01216.71
7.3.190.0130.00316.29
7.3.180.0120.00416.48
7.3.170.0090.00916.45
7.3.160.0200.00316.64
7.2.330.0110.00716.70
7.2.320.0070.01016.63
7.2.310.0130.00316.82
7.2.300.0150.00616.54
7.2.290.0130.00716.80
7.2.60.0090.00616.96
7.2.00.0060.00619.23
7.1.200.0100.00315.75
7.1.100.0030.00917.93
7.1.70.0040.00417.25
7.1.60.0030.01019.45
7.1.50.0140.01017.03
7.1.00.0030.07722.43
7.0.200.0030.00616.94
7.0.100.0270.04720.04
7.0.90.0130.06719.92
7.0.80.0130.04719.96
7.0.70.0200.07019.96
7.0.60.0330.04319.81
7.0.50.0030.05020.36
7.0.40.0100.04320.08
7.0.30.0070.08020.05
7.0.20.0070.05720.00
7.0.10.0100.07020.13
7.0.00.0070.06720.14
5.6.250.0270.06720.77
5.6.240.0130.05720.62
5.6.230.0030.05020.61
5.6.220.0030.04320.68
5.6.210.0100.04020.77
5.6.200.0070.08321.02
5.6.190.0070.06321.10
5.6.180.0100.08721.13
5.6.170.0030.05020.98
5.6.160.0100.08020.97
5.6.150.0130.06721.11
5.6.140.0100.07021.19
5.6.130.0100.06021.08
5.6.120.0130.06321.06
5.6.110.0070.09021.08
5.6.100.0100.07721.06
5.6.90.0170.04720.95
5.6.80.0200.06720.55
5.6.70.0030.08720.43
5.6.60.0030.04720.50
5.6.50.0100.06720.35
5.6.40.0170.06720.39
5.6.30.0100.07720.48
5.6.20.0130.07320.29
5.6.10.0170.06720.39
5.6.00.0030.08020.42
5.5.380.0100.06720.41
5.5.370.0070.07720.36
5.5.360.0000.05320.36
5.5.350.0170.06320.44
5.5.340.0100.06320.91
5.5.330.0100.08320.82
5.5.320.0170.06720.82
5.5.310.0130.06020.91
5.5.300.0170.07020.89
5.5.290.0230.08320.92
5.5.280.0070.04320.80
5.5.270.0100.04320.93
5.5.260.0070.05720.77
5.5.250.0200.07320.75
5.5.240.0070.07720.18
5.5.230.0070.08720.32
5.5.220.0130.07320.17
5.5.210.0030.05320.29
5.5.200.0070.06720.21
5.5.190.0130.07720.16
5.5.180.0070.08020.19
5.5.160.0130.07720.26
5.5.150.0030.05720.16
5.5.140.0100.07720.13
5.5.130.0100.07020.25
5.5.120.0130.03720.23
5.5.110.0100.07720.19
5.5.100.0070.04720.18
5.5.90.0070.07320.09
5.5.80.0070.04320.09
5.5.70.0000.07720.11
5.5.60.0070.06719.98
5.5.50.0030.05320.09
5.5.40.0070.07720.16
5.5.30.0070.07020.12
5.5.20.0130.04020.07
5.5.10.0030.04320.03
5.5.00.0030.04020.07
5.4.450.0130.06019.36
5.4.440.0170.07719.49
5.4.430.0170.07019.35
5.4.420.0030.05019.41
5.4.410.0030.08019.21
5.4.400.0130.07319.21
5.4.390.0100.07319.05
5.4.380.0100.04019.03
5.4.370.0100.07319.12
5.4.360.0100.04019.13
5.4.350.0070.08019.13
5.4.340.0070.08318.88
5.4.320.0170.03319.12
5.4.310.0100.05718.90
5.4.300.0100.06019.12
5.4.290.0100.07018.89
5.4.280.0170.07319.00
5.4.270.0100.07719.03
5.4.260.0000.05319.05
5.4.250.0000.07719.11
5.4.240.0170.07018.87
5.4.230.0030.06319.08
5.4.220.0030.06319.22
5.4.210.0170.06318.90
5.4.200.0030.07018.89
5.4.190.0130.07019.21
5.4.180.0000.04719.19
5.4.170.0030.03718.83
5.4.160.0030.04018.90
5.4.150.0070.03719.09
5.4.140.0170.02316.39
5.4.130.0130.02716.46
5.4.120.0000.04316.54
5.4.110.0070.02716.41
5.4.100.0030.03716.56
5.4.90.0000.03316.48
5.4.80.0070.03316.36
5.4.70.0000.03716.40
5.4.60.0000.03316.43
5.4.50.0070.03316.43
5.4.40.0000.04016.39
5.4.30.0100.03016.36
5.4.20.0000.03016.23
5.4.10.0030.03716.33
5.4.00.0030.03015.80
5.3.290.0130.07314.68
5.3.280.0030.07314.73
5.3.270.0030.04014.59
5.3.260.0070.03314.62
5.3.250.0100.03714.57
5.3.240.0070.03314.73
5.3.230.0030.04014.68
5.3.220.0000.04014.71
5.3.210.0070.03714.61
5.3.200.0100.03014.55
5.3.190.0000.03314.61
5.3.180.0100.04314.53
5.3.170.0030.03714.66
5.3.160.0100.02314.59
5.3.150.0100.02314.74
5.3.140.0000.04314.62
5.3.130.0030.03014.67
5.3.120.0000.03714.61
5.3.110.0130.03314.57
5.3.100.0070.02714.13
5.3.90.0000.04013.99
5.3.80.0100.04714.10
5.3.70.0030.03014.06
5.3.60.0030.03714.06
5.3.50.0030.03013.86
5.3.40.0030.03014.07
5.3.30.0030.03013.96
5.3.20.0000.03713.70
5.3.10.0100.02713.61
5.3.00.0070.03713.59
5.2.170.0000.03311.30
5.2.160.0000.03311.17
5.2.150.0070.02311.02
5.2.140.0070.02311.29
5.2.130.0070.02311.14
5.2.120.0070.02011.04
5.2.110.0070.03311.14
5.2.100.0030.03711.20
5.2.90.0000.02711.17
5.2.80.0000.04311.14
5.2.70.0030.04311.20
5.2.60.0030.03311.09
5.2.50.0030.02711.15
5.2.40.0000.02711.02
5.2.30.0030.02711.08
5.2.20.0030.02311.11
5.2.10.0030.02010.99
5.2.00.0000.03010.60
5.1.60.0030.02010.08
5.1.50.0030.02010.09
5.1.40.0070.03010.10
5.1.30.0030.02710.22
5.1.20.0000.02710.42
5.1.10.0030.02010.16
5.1.00.0070.02010.17
5.0.50.0000.0208.95
5.0.40.0000.0178.95
5.0.30.0000.0278.95
5.0.20.0070.0138.95
5.0.10.0030.0138.95
5.0.00.0000.0278.95
4.4.90.0000.0178.95
4.4.80.0000.0178.95
4.4.70.0000.0138.95
4.4.60.0000.0138.95
4.4.50.0030.0138.95
4.4.40.0000.0208.95
4.4.30.0000.0178.95
4.4.20.0030.0108.95
4.4.10.0000.0138.95
4.4.00.0000.0208.95
4.3.110.0000.0138.95
4.3.100.0000.0138.95
4.3.90.0000.0238.95
4.3.80.0030.0178.95
4.3.70.0000.0178.95
4.3.60.0030.0338.95
4.3.50.0030.0338.95
4.3.40.0000.0378.95
4.3.30.0130.0278.95
4.3.20.0000.0278.95
4.3.10.0000.0208.95
4.3.00.0000.0308.95

preferences:
30.12 ms | 403 KiB | 5 Q