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->worldName = $worldName; } private function setUID() { $this->uid = self::$id++; } public function whoIsPerson( Person $person ) { $personUID = $person->getUID(); if( $personUID === 0 && $this->worldName === 'Rapture' ) return $this->personIDMessage( $personUID, $this->worldName, 'Jack' ); elseif( $personUID === 0 && $this->worldName === 'Columbia' ) return $this->personIDMessage( $personUID, $this->worldName, 'Elizabeth' ); else return 'Unknown Person'; } private function personIDMessage( $id, $world, $name) { return "Person $id in world $world is $name \n"; } } class Person { static $id = 0; protected $uid; public function __construct() { $this->setUID(); } 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/mvggu
function name:  (null)
number of ops:  20
compiled vars:  !0 = $person1, !1 = $world1, !2 = $world2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   NEW                                              $3      'Person'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   52     3        NEW                                              $6      'World'
          4        SEND_VAL_EX                                              'Rapture'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   53     7        INIT_METHOD_CALL                                         !1, 'whoIsPerson'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $9      
         10        ECHO                                                     $9
   55    11        NEW                                              $10     'World'
         12        SEND_VAL_EX                                              'Columbia'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $10
   56    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/mvggu
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                                               'worldName'
          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/mvggu
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 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 34
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 9
filename:       /in/mvggu
function name:  whoIsPerson
number of ops:  36
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
   20     4        IS_IDENTICAL                                     ~4      !1, 0
          5      > JMPZ_EX                                          ~4      ~4, ->9
          6    >   FETCH_OBJ_R                                      ~5      'worldName'
          7        IS_IDENTICAL                                     ~6      ~5, 'Rapture'
          8        BOOL                                             ~4      ~6
          9    > > JMPZ                                                     ~4, ->19
   21    10    >   INIT_METHOD_CALL                                         'personIDMessage'
         11        SEND_VAR_EX                                              !1
         12        CHECK_FUNC_ARG                                           
         13        FETCH_OBJ_FUNC_ARG                               $7      'worldName'
         14        SEND_FUNC_ARG                                            $7
         15        SEND_VAL_EX                                              'Jack'
         16        DO_FCALL                                      0  $8      
         17      > RETURN                                                   $8
         18*       JMP                                                      ->35
   22    19    >   IS_IDENTICAL                                     ~9      !1, 0
         20      > JMPZ_EX                                          ~9      ~9, ->24
         21    >   FETCH_OBJ_R                                      ~10     'worldName'
         22        IS_IDENTICAL                                     ~11     ~10, 'Columbia'
         23        BOOL                                             ~9      ~11
         24    > > JMPZ                                                     ~9, ->34
   23    25    >   INIT_METHOD_CALL                                         'personIDMessage'
         26        SEND_VAR_EX                                              !1
         27        CHECK_FUNC_ARG                                           
         28        FETCH_OBJ_FUNC_ARG                               $12     'worldName'
         29        SEND_FUNC_ARG                                            $12
         30        SEND_VAL_EX                                              'Elizabeth'
         31        DO_FCALL                                      0  $13     
         32      > RETURN                                                   $13
         33*       JMP                                                      ->35
   25    34    > > RETURN                                                   'Unknown+Person'
   26    35*     > RETURN                                                   null

End of function whoisperson

Function personidmessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mvggu
function name:  personIDMessage
number of ops:  12
compiled vars:  !0 = $id, !1 = $world, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   29     3        ROPE_INIT                                     7  ~4      'Person+'
          4        ROPE_ADD                                      1  ~4      ~4, !0
          5        ROPE_ADD                                      2  ~4      ~4, '+in+world+'
          6        ROPE_ADD                                      3  ~4      ~4, !1
          7        ROPE_ADD                                      4  ~4      ~4, '+is+'
          8        ROPE_ADD                                      5  ~4      ~4, !2
          9        ROPE_END                                      6  ~3      ~4, '+%0A'
         10      > RETURN                                                   ~3
   30    11*     > RETURN                                                   null

End of function personidmessage

End of class World.

Class Person:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mvggu
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   INIT_METHOD_CALL                                         'setUID'
          1        DO_FCALL                                      0          
   39     2      > 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/mvggu
function name:  setUID
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   POST_INC_STATIC_PROP                             ~1      'id'
          1        ASSIGN_OBJ                                               'uid'
          2        OP_DATA                                                  ~1
   43     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/mvggu
function name:  getUID
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   FETCH_OBJ_R                                      ~0      'uid'
          1      > RETURN                                                   ~0
   47     2*     > RETURN                                                   null

End of function getuid

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.28 ms | 1403 KiB | 13 Q