3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This is a basic class without any special behavior. No deprecation error occur despite the public_property being unset. $foo = new Foo(); $foo->public_property = true; unset( $foo->public_property ); $foo->public_property = true; // A class with a __set magic method that allows modifying declared public properties, mimicking the basic class behaviour and providing more backward compatibility. $baz = new Baz(); $baz->public_property = true; unset( $baz->public_property ); $baz->public_property = true; // This is a class with a __set magic method that restricts dynamic property creation. $bar = new Bar(); $bar->public_property = true; unset( $bar->public_property ); $bar->public_property = true; class Foo { public $public_property; } class Baz { public $public_property; public function __set( $prop, $value ) { if ( 'known_dynamic_property' === $prop ) { // Dynamic property-specific logic goes here. return; } // Checks if the property is a known public property and allows setting it. if ( 'public_property' === $prop ) { $this->public_property = $value; return; } trigger_error( sprintf( 'Setting the dynamic property "%s" on %s is deprecated', $prop, __CLASS__ ), E_USER_DEPRECATED ); } } class Bar { public $public_property; public function __set( $prop, $value ) { if ( 'known_dynamic_property' === $prop ) { // Dynamic property-specific logic goes here. return; } trigger_error( sprintf( 'Setting the dynamic property "%s" on %s is deprecated', $prop, __CLASS__ ), E_USER_DEPRECATED ); } }

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.20.0030.00620.61
8.4.10.0040.00419.36
8.3.140.0090.00916.76
8.3.130.0060.00318.62
8.3.120.0050.00518.84
8.3.110.0000.00818.65
8.3.100.0000.00816.78
8.3.90.0050.00318.49
8.3.80.0070.00719.36
8.3.70.0090.00618.68
8.3.60.0300.00925.92
8.3.50.0170.00025.92
8.3.40.0070.01325.92
8.2.260.0110.00718.37
8.2.250.0070.00717.01
8.2.240.0000.00817.30
8.2.230.0040.00420.94
8.2.220.0040.00416.95
8.2.210.0060.00326.77
8.2.200.0030.00618.29
8.2.190.0110.00416.63
8.2.180.0140.00725.92
8.2.170.0030.01425.92
8.1.310.0040.00418.42
8.1.300.0040.00416.82
8.1.290.0090.00018.88
8.1.280.0030.01025.92

preferences:
33.38 ms | 403 KiB | 5 Q