3v4l.org

run code in 300+ PHP versions simultaneously
<?php class With_Magic_Methods { private $_args; protected $compat_fields = array( '_args' ); public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } return false; } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } } class No_Magic_Methods { public $_args; } class WP_31_Version { /** * Various information about the current table * * @since 3.1.0 * @var array * @access private */ var $_args; /** * Constructor. The child class should call this constructor from it's own constructor * * @param array $args An associative array with information about the current table * @access protected */ function WP_List_Table( $args = array() ) {} } $wp_31_version = new WP_31_Version(); $current = new With_Magic_Methods(); $option2 = new No_Magic_Methods(); function _get() { global $wp_31_version, $current, $option2; echo "- - - - - - - - - - -\n"; echo "šŸ‘‰ Defined property: \n"; echo "- - - - - - - - - - -\n"; echo "šŸ”ø WP 3.1 code: "; var_dump( $wp_31_version->_args ); echo "\nšŸ”ø Current code: "; var_dump( $current->_args ); echo "\nšŸ”ø Option 2: "; var_dump( $option2->_args ); echo "\n- - - - - - - - - - -\n"; echo "šŸ‘‰ Dynamic property: \n"; echo "- - - - - - - - - - -\n"; echo "šŸ”ø WP 3.1 code: "; var_dump( $wp_31_version->_dynamic_property ); echo "\nšŸ”ø Current code: "; var_dump( $current->_dynamic_property ); echo "\nšŸ”ø Option 2: "; var_dump( $option2->_dynamic_property ); } function test_get( $message = '' ) { echo "*********************\n"; printf( "šŸ”¶šŸ”¶ Test get%s šŸ”¶šŸ”¶\n", $message ); echo "*********************\n\n"; _get(); echo "\n\n"; } function test_isset( $message = '' ) { global $wp_31_version, $current, $option2; echo "*********************\n"; printf( "šŸ”¶šŸ”¶ Test isset()%s šŸ”¶šŸ”¶\n", $message ); echo "*********************\n\n"; echo "- - - - - - - - - - -\n"; echo "šŸ‘‰ Defined property: \n"; echo "- - - - - - - - - - -\n"; echo "šŸ”ø WP 3.1 code: "; var_dump( isset( $wp_31_version->_args ) ); echo "\nšŸ”ø Current code: "; var_dump( isset( $current->_args ) ); echo "\nšŸ”ø Option 2: "; var_dump( isset( $option2->_args ) ); echo "\n- - - - - - - - - - -\n"; echo "šŸ‘‰ Dynamic property: \n"; echo "- - - - - - - - - - -\n"; echo "šŸ”ø WP 3.1 code: "; var_dump( isset( $wp_31_version->_dynamic_property ) ); echo "\nšŸ”ø Current code: "; var_dump( isset( $current->_dynamic_property ) ); echo "\nšŸ”ø Option 2: "; var_dump( isset( $option2->_dynamic_property ) ); echo "\n\n"; } function test_set( $message = '' ) { global $wp_31_version, $current, $option2; $new_value = array( 'test' ); $wp_31_version->_args = $new_value; $wp_31_version->_dynamic_property = $new_value; $current->_args = $new_value; $current->_dynamic_property = $new_value; $option2->_args = $new_value; $option2->_dynamic_property = $new_value; echo "*********************\n"; printf( "šŸ”¶šŸ”¶ Test set%s šŸ”¶šŸ”¶\n\n", $message ); echo "*********************\n"; _get(); echo "\n\n"; } echo "\n ***** COMPARE WITH WP 3.1 WP_List_Table ***** \n\n"; test_get(); test_isset(); test_set(); // Unset. unset( $wp_31_version->_args ); unset( $wp_31_version->_dynamic_property ); unset( $current->_args ); unset( $current->_dynamic_property ); unset( $option2->_args ); unset( $option2->_dynamic_property ); test_get( ' after unset()' ); test_isset( ' after unset()' ); test_set( ' after unset()' ); test_isset( ' after unset() and set' ); run_test();

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.0070.01022.57
8.4.10.0050.00323.76
8.3.150.0060.01317.50
8.3.140.0040.00716.80
8.3.130.0070.00318.83
8.3.120.0070.00319.01
8.3.110.0130.00616.75
8.3.100.0050.00524.06
8.3.90.0000.00826.77
8.3.80.0000.00917.97
8.3.70.0120.00318.40
8.3.60.0060.01618.65
8.3.50.0110.01116.96
8.3.40.0140.00323.73
8.3.30.0090.00620.30
8.3.20.0080.00024.18
8.3.10.0000.00824.66
8.3.00.0080.00026.16
8.2.270.0150.00417.38
8.2.260.0080.01116.96
8.2.250.0110.00718.82
8.2.240.0030.00718.94
8.2.230.0030.00720.94
8.2.220.0060.00337.54
8.2.210.0110.00726.77
8.2.200.0050.00516.75
8.2.190.0090.00618.22
8.2.180.0070.01016.63
8.2.170.0040.01119.21
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.54
8.2.110.0030.00620.56
8.2.100.0060.00320.32
8.1.310.0040.00418.40
8.1.300.0060.00318.45
8.1.290.0030.00718.88
8.1.280.0030.01625.92
8.1.270.0050.00324.66
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0040.00718.61
8.1.230.0130.01018.66
8.1.200.0050.00579.33

preferences:
27.17 ms | 403 KiB | 5 Q