3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $_count = 0; private $_number; function __construct() { $this->_number = ++static::$_count; } public function __toString(){ return static::$_count . ' | ' . $this->_number . "\n"; } public function __invoke(){ return $this->_number; } } class B { private $_status = C::newInstance; public function show (){echo $this->_status;} } class C { private $message; public function __construct($message){ $this->message = $message; } public static function newInstance($message){ return new C($message); } public function __toString(){ return $this->message . " | "; } } $_b = new B(); $_b->show(); $a = new A(); $b = new A(); $c = new A(); $d = new A(); echo $a, $b, $c, $d; echo $a(), $b(), $c(), $d();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  (null)
number of ops:  36
compiled vars:  !0 = $_b, !1 = $a, !2 = $b, !3 = $c, !4 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'a'
   23     1        DECLARE_CLASS                                            'c'
   39     2        NEW                                              $5      'B'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
   40     5        INIT_METHOD_CALL                                         !0, 'show'
          6        DO_FCALL                                      0          
   42     7        NEW                                              $9      'A'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $9
   43    10        NEW                                              $12     'A'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   44    13        NEW                                              $15     'A'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $15
   45    16        NEW                                              $18     'A'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !4, $18
   47    19        ECHO                                                     !1
         20        ECHO                                                     !2
         21        ECHO                                                     !3
         22        ECHO                                                     !4
   48    23        INIT_DYNAMIC_CALL                                        !1
         24        DO_FCALL                                      0  $21     
         25        ECHO                                                     $21
         26        INIT_DYNAMIC_CALL                                        !2
         27        DO_FCALL                                      0  $22     
         28        ECHO                                                     $22
         29        INIT_DYNAMIC_CALL                                        !3
         30        DO_FCALL                                      0  $23     
         31        ECHO                                                     $23
         32        INIT_DYNAMIC_CALL                                        !4
         33        DO_FCALL                                      0  $24     
         34        ECHO                                                     $24
         35      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   PRE_INC_STATIC_PROP                              ~1      '_count'
          1        ASSIGN_OBJ                                               '_number'
          2        OP_DATA                                                  ~1
    7     3      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      '_count'
          1        CONCAT                                           ~1      ~0, '+%7C+'
          2        FETCH_OBJ_R                                      ~2      '_number'
          3        CONCAT                                           ~3      ~1, ~2
          4        CONCAT                                           ~4      ~3, '%0A'
          5        VERIFY_RETURN_TYPE                                       ~4
          6      > RETURN                                                   ~4
   11     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  __invoke
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      '_number'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function __invoke

End of class A.

Class B:
Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  show
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      '_status'
          1        ECHO                                                     ~0
          2      > RETURN                                                   null

End of function show

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        ASSIGN_OBJ                                               'message'
          2        OP_DATA                                                  !0
   27     3      > RETURN                                                   null

End of function __construct

Function newinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  newInstance
number of ops:  6
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   30     1        NEW                                              $1      'C'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $1
   31     5*     > RETURN                                                   null

End of function newinstance

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9KiD0
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   FETCH_OBJ_R                                      ~0      'message'
          1        CONCAT                                           ~1      ~0, '+%7C+'
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   35     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
256.44 ms | 1403 KiB | 14 Q