3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Profile { private $active = false; public function activate() { $this->active = true; } public function isActive() { return $this->active; } } interface Event { function execute($object); } class ProfileWasActivated implements Event { public function execute($profile) { $profile->activate(); } } class EventDomainObjectLoader { public static function load($object, array $events) { foreach($events as $event) { $event->execute($object); } return $object; } } EventDomainObjectLoader::load(new Profile(), [new ProfileWasActivated()]); var_dump($profile->isActive());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6T2t
function name:  (null)
number of ops:  16
compiled vars:  !0 = $profile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_CLASS                                            'profilewasactivated'
   34     1        INIT_STATIC_METHOD_CALL                                  'EventDomainObjectLoader', 'load'
          2        NEW                                              $1      'Profile'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $1
          5        NEW                                              $3      'ProfileWasActivated'
          6        DO_FCALL                                      0          
          7        INIT_ARRAY                                       ~5      $3
          8        SEND_VAL                                                 ~5
          9        DO_FCALL                                      0          
   35    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'isActive'
         12        DO_FCALL                                      0  $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class Profile:
Function activate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6T2t
function name:  activate
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'active'
          1        OP_DATA                                                  <true>
    8     2      > RETURN                                                   null

End of function activate

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

End of function isactive

End of class Profile.

Class Event:
Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6T2t
function name:  execute
number of ops:  2
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function execute

End of class Event.

Class ProfileWasActivated:
Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o6T2t
function name:  execute
number of ops:  4
compiled vars:  !0 = $profile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_METHOD_CALL                                         !0, 'activate'
          2        DO_FCALL                                      0          
   22     3      > RETURN                                                   null

End of function execute

End of class ProfileWasActivated.

Class EventDomainObjectLoader:
Function load:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/o6T2t
function name:  load
number of ops:  11
compiled vars:  !0 = $object, !1 = $events, !2 = $event
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2      > FE_RESET_R                                       $3      !1, ->8
          3    > > FE_FETCH_R                                               $3, !2, ->8
   28     4    >   INIT_METHOD_CALL                                         !2, 'execute'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   27     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $3
   30     9      > RETURN                                                   !0
   31    10*     > RETURN                                                   null

End of function load

End of class EventDomainObjectLoader.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.15 ms | 1400 KiB | 15 Q