3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Papa { public function __construct() { $args = func_get_args(); echo print_r($args, true); } } class Kiddo extends Papa { public function __construct() { $args = func_get_args(); $parent_class = 'parent'; if (version_compare(PHP_VERSION, '5.5.0') >= 0) { $parent_class = parent::class; } call_user_func_array(array($parent_class, '__construct'), $args); } } $x = new Papa('bee'); $y = new Kiddo('hello', 'me');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E9eTR
function name:  (null)
number of ops:  10
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'Papa'
          1        SEND_VAL_EX                                              'bee'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   22     4        NEW                                              $5      'Kiddo'
          5        SEND_VAL_EX                                              'hello'
          6        SEND_VAL_EX                                              'me'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
          9      > RETURN                                                   1

Class Papa:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E9eTR
function name:  __construct
number of ops:  8
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FUNC_GET_ARGS                                    ~1      
          1        ASSIGN                                                   !0, ~1
    6     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        ECHO                                                     $3
    7     7      > RETURN                                                   null

End of function __construct

End of class Papa.

Class Kiddo:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/E9eTR
function name:  __construct
number of ops:  17
compiled vars:  !0 = $args, !1 = $parent_class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FUNC_GET_ARGS                                    ~2      
          1        ASSIGN                                                   !0, ~2
   13     2        ASSIGN                                                   !1, 'parent'
   14     3        INIT_FCALL                                               'version_compare'
          4        SEND_VAL                                                 '8.3.0'
          5        SEND_VAL                                                 '5.5.0'
          6        DO_ICALL                                         $5      
          7        IS_SMALLER_OR_EQUAL                                      0, $5
          8      > JMPZ                                                     ~6, ->10
   15     9    >   ASSIGN                                                   !1, 'Papa'
   17    10    >   INIT_ARRAY                                       ~8      !1
         11        ADD_ARRAY_ELEMENT                                ~8      '__construct'
         12        INIT_USER_CALL                                0          'call_user_func_array', ~8
         13        SEND_ARRAY                                               !0
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      1          
   18    16      > RETURN                                                   null

End of function __construct

End of class Kiddo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.78 ms | 1449 KiB | 15 Q