3v4l.org

run code in 300+ PHP versions simultaneously
<?php // From https://core.trac.wordpress.org/browser/trunk/wp-admin/includes/list-table.php?rev=15491. class WP_List_Table { /** * Various information about the current table * * @since 3.1.0 * @var array * @access private */ var $_args; /** * Various information needed for displaying the pagination * * @since 3.1.0 * @var array * @access private */ var $_pagination_args = array(); /** * The current screen * * @since 3.1.0 * @var object * @access protected */ var $screen; /** * Cached bulk actions * * @since 3.1.0 * @var array * @access private */ var $_actions; /** * Cached pagination output * * @since 3.1.0 * @var string * @access private */ var $_pagination; /** * 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() ) {} } function run_test() { $obj = new WP_List_Table(); echo "\n ***** TEST WP 3.1 CODE ***** \n\n\n"; // __get() echo "** Test get **\n"; echo "Defined property: "; var_dump( $obj->_args ); echo "Dynamic property: "; var_dump( $obj->_dynamic_property ); // __isset() echo "\n\n ** Test `isset()` **\n"; echo "Defined property: "; var_dump( isset( $obj->_args ) ); echo "Dynamic property: "; var_dump( isset( $obj->_dynamic_property ) ); // __set() echo "\n\n ** Test set **\n"; $new_value = array( 'test' ); $obj->_args = $new_value; $obj->_dynamic_property = $new_value; echo "With magic methods: "; var_dump( $obj->_args ); echo "Dynamic property: "; var_dump( $obj->_dynamic_property ); // Unset. unset( $obj->_args ); unset( $obj->_dynamic_property ); echo "\n\n ** Test get after `unset()` **\n"; echo "Defined property: "; var_dump( $obj->_args ); echo "Dynamic property: "; var_dump( $obj->_dynamic_property ); echo "\n\n ** Test `isset()` after `unset()` **\n"; echo "Defined property: "; var_dump( isset( $obj->_args ) ); echo "Dynamic property: "; var_dump( isset( $obj->_dynamic_property ) ); echo "\n\n ** Test set after `unset()` **\n"; $new_value = array( 'test after an unset' ); $obj->_args = $new_value; $obj->_dynamic_property = $new_value; echo "Defined property: "; var_dump( $obj->_args ); echo "Dynamic property: "; var_dump( $obj->_dynamic_property ); echo "\n\n ** Test `isset()` after `unset()` and set **\n"; echo "Defined property: "; var_dump( isset( $obj->_args ) ); echo "Dynamic property: "; var_dump( isset( $obj->_dynamic_property ) ); } run_test();
Output for 8.2.10 - 8.2.23, 8.3.0 - 8.3.11
***** TEST WP 3.1 CODE ***** ** Test get ** Defined property: NULL Dynamic property: Warning: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 71 NULL ** Test `isset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set ** Deprecated: Creation of dynamic property WP_List_Table::$_dynamic_property is deprecated in /in/GBfpi on line 84 With magic methods: array(1) { [0]=> string(4) "test" } Dynamic property: array(1) { [0]=> string(4) "test" } ** Test get after `unset()` ** Defined property: Warning: Undefined property: WP_List_Table::$_args in /in/GBfpi on line 96 NULL Dynamic property: Warning: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 98 NULL ** Test `isset()` after `unset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set after `unset()` ** Deprecated: Creation of dynamic property WP_List_Table::$_dynamic_property is deprecated in /in/GBfpi on line 109 Defined property: array(1) { [0]=> string(19) "test after an unset" } Dynamic property: array(1) { [0]=> string(19) "test after an unset" } ** Test `isset()` after `unset()` and set ** Defined property: bool(true) Dynamic property: bool(true)
Output for 8.1.20 - 8.1.29
***** TEST WP 3.1 CODE ***** ** Test get ** Defined property: NULL Dynamic property: Warning: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 71 NULL ** Test `isset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set ** With magic methods: array(1) { [0]=> string(4) "test" } Dynamic property: array(1) { [0]=> string(4) "test" } ** Test get after `unset()` ** Defined property: Warning: Undefined property: WP_List_Table::$_args in /in/GBfpi on line 96 NULL Dynamic property: Warning: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 98 NULL ** Test `isset()` after `unset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set after `unset()` ** Defined property: array(1) { [0]=> string(19) "test after an unset" } Dynamic property: array(1) { [0]=> string(19) "test after an unset" } ** Test `isset()` after `unset()` and set ** Defined property: bool(true) Dynamic property: bool(true)
Output for 5.2.17
***** TEST WP 3.1 CODE ***** ** Test get ** Defined property: NULL Dynamic property: Notice: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 71 NULL ** Test `isset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set ** With magic methods: array(1) { [0]=> string(4) "test" } Dynamic property: array(1) { [0]=> string(4) "test" } ** Test get after `unset()` ** Defined property: Notice: Undefined property: WP_List_Table::$_args in /in/GBfpi on line 96 NULL Dynamic property: Notice: Undefined property: WP_List_Table::$_dynamic_property in /in/GBfpi on line 98 NULL ** Test `isset()` after `unset()` ** Defined property: bool(false) Dynamic property: bool(false) ** Test set after `unset()` ** Defined property: array(1) { [0]=> string(19) "test after an unset" } Dynamic property: array(1) { [0]=> string(19) "test after an unset" } ** Test `isset()` after `unset()` and set ** Defined property: bool(true) Dynamic property: bool(true)

preferences:
49.98 ms | 414 KiB | 5 Q