3v4l.org

run code in 300+ PHP versions simultaneously
<?php class World { static $id = 0; protected $uid; protected $worldName; const type = 'world'; public function __construct( $worldName ) { $this->setUID(); $this->wrldName = $worldName; } private function setUID() { $this->uid = self::$id++; } public function whoIsPerson( Person $person ) { $personUID = $person->getUID(); var_dump( $personUID ); if( $personUID === 0 && $this->worldName === 'Rapture' ) return 'Jack'; elseif( $personUID === 0 && $this->worldName === 'Columbia' ) return 'Elizabeth'; else return 'Unknown Person'; } } class Person { static $id = 0; protected $uid; private function setUID() { $this->uid = self::$id++; } public function getUID() { return $this->uid; } } $person1 = new Person(); $world1 = new World('Rapture'); echo $world1->whoIsPerson( $person1 ); $world2 = new World('Columbia'); echo $world2->whoIsPerson( $person1 );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgkC7
function name:  (null)
number of ops:  20
compiled vars:  !0 = $person1, !1 = $world1, !2 = $world2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   NEW                                              $3      'Person'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   44     3        NEW                                              $6      'World'
          4        SEND_VAL_EX                                              'Rapture'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   45     7        INIT_METHOD_CALL                                         !1, 'whoIsPerson'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $9      
         10        ECHO                                                     $9
   47    11        NEW                                              $10     'World'
         12        SEND_VAL_EX                                              'Columbia'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $10
   48    15        INIT_METHOD_CALL                                         !2, 'whoIsPerson'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $13     
         18        ECHO                                                     $13
         19      > RETURN                                                   1

Class World:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgkC7
function name:  __construct
number of ops:  6
compiled vars:  !0 = $worldName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_METHOD_CALL                                         'setUID'
          2        DO_FCALL                                      0          
   10     3        ASSIGN_OBJ                                               'wrldName'
          4        OP_DATA                                                  !0
   11     5      > RETURN                                                   null

End of function __construct

Function setuid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgkC7
function name:  setUID
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   POST_INC_STATIC_PROP                             ~1      'id'
          1        ASSIGN_OBJ                                               'uid'
          2        OP_DATA                                                  ~1
   15     3      > RETURN                                                   null

End of function setuid

Function whoisperson:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 12
filename:       /in/BgkC7
function name:  whoIsPerson
number of ops:  25
compiled vars:  !0 = $person, !1 = $personUID
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_METHOD_CALL                                         !0, 'getUID'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
   19     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   20     7        IS_IDENTICAL                                     ~5      !1, 0
          8      > JMPZ_EX                                          ~5      ~5, ->12
          9    >   FETCH_OBJ_R                                      ~6      'worldName'
         10        IS_IDENTICAL                                     ~7      ~6, 'Rapture'
         11        BOOL                                             ~5      ~7
         12    > > JMPZ                                                     ~5, ->15
   21    13    > > RETURN                                                   'Jack'
         14*       JMP                                                      ->24
   22    15    >   IS_IDENTICAL                                     ~8      !1, 0
         16      > JMPZ_EX                                          ~8      ~8, ->20
         17    >   FETCH_OBJ_R                                      ~9      'worldName'
         18        IS_IDENTICAL                                     ~10     ~9, 'Columbia'
         19        BOOL                                             ~8      ~10
         20    > > JMPZ                                                     ~8, ->23
   23    21    > > RETURN                                                   'Elizabeth'
         22*       JMP                                                      ->24
   25    23    > > RETURN                                                   'Unknown+Person'
   26    24*     > RETURN                                                   null

End of function whoisperson

End of class World.

Class Person:
Function setuid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgkC7
function name:  setUID
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   POST_INC_STATIC_PROP                             ~1      'id'
          1        ASSIGN_OBJ                                               'uid'
          2        OP_DATA                                                  ~1
   35     3      > RETURN                                                   null

End of function setuid

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

End of function getuid

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.28 ms | 1404 KiB | 15 Q