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();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  (null)
number of ops:  37
compiled vars:  !0 = $wp_31_version, !1 = $current, !2 = $option2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   NEW                                              $3      'WP_31_Version'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   59     3        NEW                                              $6      'With_Magic_Methods'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   60     6        NEW                                              $9      'No_Magic_Methods'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $9
  143     9        ECHO                                                     '%0A+%2A%2A%2A%2A%2A+COMPARE+WITH+WP+3.1+WP_List_Table+%2A%2A%2A%2A%2A+%0A%0A'
  145    10        INIT_FCALL                                               'test_get'
         11        DO_FCALL                                      0          
  146    12        INIT_FCALL                                               'test_isset'
         13        DO_FCALL                                      0          
  147    14        INIT_FCALL                                               'test_set'
         15        DO_FCALL                                      0          
  150    16        UNSET_OBJ                                                !0, '_args'
  151    17        UNSET_OBJ                                                !0, '_dynamic_property'
  152    18        UNSET_OBJ                                                !1, '_args'
  153    19        UNSET_OBJ                                                !1, '_dynamic_property'
  154    20        UNSET_OBJ                                                !2, '_args'
  155    21        UNSET_OBJ                                                !2, '_dynamic_property'
  157    22        INIT_FCALL                                               'test_get'
         23        SEND_VAL                                                 '+after+unset%28%29'
         24        DO_FCALL                                      0          
  158    25        INIT_FCALL                                               'test_isset'
         26        SEND_VAL                                                 '+after+unset%28%29'
         27        DO_FCALL                                      0          
  159    28        INIT_FCALL                                               'test_set'
         29        SEND_VAL                                                 '+after+unset%28%29'
         30        DO_FCALL                                      0          
  160    31        INIT_FCALL                                               'test_isset'
         32        SEND_VAL                                                 '+after+unset%28%29+and+set'
         33        DO_FCALL                                      0          
  162    34        INIT_FCALL_BY_NAME                                       'run_test'
         35        DO_FCALL                                      0          
         36      > RETURN                                                   1

Function _get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  _get
number of ops:  40
compiled vars:  !0 = $wp_31_version, !1 = $current, !2 = $option2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   BIND_GLOBAL                                              !0, 'wp_31_version'
          1        BIND_GLOBAL                                              !1, 'current'
          2        BIND_GLOBAL                                              !2, 'option2'
   65     3        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
   66     4        ECHO                                                     '%F0%9F%91%89+Defined+property%3A+%0A'
   67     5        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
   68     6        ECHO                                                     '%F0%9F%94%B8+WP+3.1+code%3A+'
   69     7        INIT_FCALL                                               'var_dump'
          8        FETCH_OBJ_R                                      ~3      !0, '_args'
          9        SEND_VAL                                                 ~3
         10        DO_ICALL                                                 
   70    11        ECHO                                                     '%0A%F0%9F%94%B8+Current+code%3A+'
   71    12        INIT_FCALL                                               'var_dump'
         13        FETCH_OBJ_R                                      ~5      !1, '_args'
         14        SEND_VAL                                                 ~5
         15        DO_ICALL                                                 
   72    16        ECHO                                                     '%0A%F0%9F%94%B8+Option+2%3A+'
   73    17        INIT_FCALL                                               'var_dump'
         18        FETCH_OBJ_R                                      ~7      !2, '_args'
         19        SEND_VAL                                                 ~7
         20        DO_ICALL                                                 
   75    21        ECHO                                                     '%0A-+-+-+-+-+-+-+-+-+-+-%0A'
   76    22        ECHO                                                     '%F0%9F%91%89+Dynamic+property%3A+%0A'
   77    23        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
   78    24        ECHO                                                     '%F0%9F%94%B8+WP+3.1+code%3A+'
   79    25        INIT_FCALL                                               'var_dump'
         26        FETCH_OBJ_R                                      ~9      !0, '_dynamic_property'
         27        SEND_VAL                                                 ~9
         28        DO_ICALL                                                 
   80    29        ECHO                                                     '%0A%F0%9F%94%B8+Current+code%3A+'
   81    30        INIT_FCALL                                               'var_dump'
         31        FETCH_OBJ_R                                      ~11     !1, '_dynamic_property'
         32        SEND_VAL                                                 ~11
         33        DO_ICALL                                                 
   82    34        ECHO                                                     '%0A%F0%9F%94%B8+Option+2%3A+'
   83    35        INIT_FCALL                                               'var_dump'
         36        FETCH_OBJ_R                                      ~13     !2, '_dynamic_property'
         37        SEND_VAL                                                 ~13
         38        DO_ICALL                                                 
   84    39      > RETURN                                                   null

End of function _get

Function test_get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  test_get
number of ops:  11
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   86     0  E >   RECV_INIT                                        !0      ''
   87     1        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A'
   88     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 '%F0%9F%94%B6%F0%9F%94%B6+Test+get%25s+%F0%9F%94%B6%F0%9F%94%B6%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   89     6        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A%0A'
   90     7        INIT_FCALL                                               '_get'
          8        DO_FCALL                                      0          
   91     9        ECHO                                                     '%0A%0A'
   92    10      > RETURN                                                   null

End of function test_get

Function test_isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  test_isset
number of ops:  48
compiled vars:  !0 = $message, !1 = $wp_31_version, !2 = $current, !3 = $option2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV_INIT                                        !0      ''
   95     1        BIND_GLOBAL                                              !1, 'wp_31_version'
          2        BIND_GLOBAL                                              !2, 'current'
          3        BIND_GLOBAL                                              !3, 'option2'
   97     4        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A'
   98     5        INIT_FCALL                                               'printf'
          6        SEND_VAL                                                 '%F0%9F%94%B6%F0%9F%94%B6+Test+isset%28%29%25s+%F0%9F%94%B6%F0%9F%94%B6%0A'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   99     9        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A%0A'
  101    10        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
  102    11        ECHO                                                     '%F0%9F%91%89+Defined+property%3A+%0A'
  103    12        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
  104    13        ECHO                                                     '%F0%9F%94%B8+WP+3.1+code%3A+'
  105    14        INIT_FCALL                                               'var_dump'
         15        ISSET_ISEMPTY_PROP_OBJ                           ~5      !1, '_args'
         16        SEND_VAL                                                 ~5
         17        DO_ICALL                                                 
  106    18        ECHO                                                     '%0A%F0%9F%94%B8+Current+code%3A+'
  107    19        INIT_FCALL                                               'var_dump'
         20        ISSET_ISEMPTY_PROP_OBJ                           ~7      !2, '_args'
         21        SEND_VAL                                                 ~7
         22        DO_ICALL                                                 
  108    23        ECHO                                                     '%0A%F0%9F%94%B8+Option+2%3A+'
  109    24        INIT_FCALL                                               'var_dump'
         25        ISSET_ISEMPTY_PROP_OBJ                           ~9      !3, '_args'
         26        SEND_VAL                                                 ~9
         27        DO_ICALL                                                 
  111    28        ECHO                                                     '%0A-+-+-+-+-+-+-+-+-+-+-%0A'
  112    29        ECHO                                                     '%F0%9F%91%89+Dynamic+property%3A+%0A'
  113    30        ECHO                                                     '-+-+-+-+-+-+-+-+-+-+-%0A'
  114    31        ECHO                                                     '%F0%9F%94%B8+WP+3.1+code%3A+'
  115    32        INIT_FCALL                                               'var_dump'
         33        ISSET_ISEMPTY_PROP_OBJ                           ~11     !1, '_dynamic_property'
         34        SEND_VAL                                                 ~11
         35        DO_ICALL                                                 
  116    36        ECHO                                                     '%0A%F0%9F%94%B8+Current+code%3A+'
  117    37        INIT_FCALL                                               'var_dump'
         38        ISSET_ISEMPTY_PROP_OBJ                           ~13     !2, '_dynamic_property'
         39        SEND_VAL                                                 ~13
         40        DO_ICALL                                                 
  118    41        ECHO                                                     '%0A%F0%9F%94%B8+Option+2%3A+'
  119    42        INIT_FCALL                                               'var_dump'
         43        ISSET_ISEMPTY_PROP_OBJ                           ~15     !3, '_dynamic_property'
         44        SEND_VAL                                                 ~15
         45        DO_ICALL                                                 
  121    46        ECHO                                                     '%0A%0A'
  122    47      > RETURN                                                   null

End of function test_isset

Function test_set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  test_set
number of ops:  27
compiled vars:  !0 = $message, !1 = $wp_31_version, !2 = $current, !3 = $option2, !4 = $new_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  124     0  E >   RECV_INIT                                        !0      ''
  125     1        BIND_GLOBAL                                              !1, 'wp_31_version'
          2        BIND_GLOBAL                                              !2, 'current'
          3        BIND_GLOBAL                                              !3, 'option2'
  127     4        ASSIGN                                                   !4, <array>
  128     5        ASSIGN_OBJ                                               !1, '_args'
          6        OP_DATA                                                  !4
  129     7        ASSIGN_OBJ                                               !1, '_dynamic_property'
          8        OP_DATA                                                  !4
  130     9        ASSIGN_OBJ                                               !2, '_args'
         10        OP_DATA                                                  !4
  131    11        ASSIGN_OBJ                                               !2, '_dynamic_property'
         12        OP_DATA                                                  !4
  132    13        ASSIGN_OBJ                                               !3, '_args'
         14        OP_DATA                                                  !4
  133    15        ASSIGN_OBJ                                               !3, '_dynamic_property'
         16        OP_DATA                                                  !4
  135    17        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A'
  136    18        INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 '%F0%9F%94%B6%F0%9F%94%B6+Test+set%25s+%F0%9F%94%B6%F0%9F%94%B6%0A%0A'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
  137    22        ECHO                                                     '%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%0A'
  139    23        INIT_FCALL                                               '_get'
         24        DO_FCALL                                      0          
  140    25        ECHO                                                     '%0A%0A'
  141    26      > RETURN                                                   null

End of function test_set

Class With_Magic_Methods:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        FETCH_OBJ_R                                      ~1      'compat_fields'
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7      > JMPZ                                                     $2, ->10
    9     8    >   FETCH_OBJ_R                                      ~3      !0
          9      > RETURN                                                   ~3
   11    10    > > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  __set
number of ops:  13
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !0
          4        FETCH_OBJ_R                                      ~2      'compat_fields'
          5        SEND_VAL                                                 ~2
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $3      
          8      > JMPZ                                                     $3, ->12
   15     9    >   ASSIGN_OBJ                                       ~4      !0
         10        OP_DATA                                                  !1
         11      > RETURN                                                   ~4
   17    12    > > RETURN                                                   null

End of function __set

Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  __isset
number of ops:  12
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        FETCH_OBJ_R                                      ~1      'compat_fields'
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7      > JMPZ                                                     $2, ->10
   21     8    >   ISSET_ISEMPTY_PROP_OBJ                           ~3      !0
          9      > RETURN                                                   ~3
   24    10    > > RETURN                                                   <false>
   25    11*     > RETURN                                                   null

End of function __isset

Function __unset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/DZnjf
function name:  __unset
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        FETCH_OBJ_R                                      ~1      'compat_fields'
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7      > JMPZ                                                     $2, ->9
   29     8    >   UNSET_OBJ                                                !0
   31     9    > > RETURN                                                   null

End of function __unset

End of class With_Magic_Methods.

Class No_Magic_Methods: [no user functions]
Class WP_31_Version:
Function wp_list_table:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DZnjf
function name:  WP_List_Table
number of ops:  2
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV_INIT                                        !0      <array>
          1      > RETURN                                                   null

End of function wp_list_table

End of class WP_31_Version.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.97 ms | 1485 KiB | 25 Q