3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Human { private $alive = TRUE; private $name; public function __construct($name = NULL) { $this->name = $name ?: 'Person'; } public function is_alive() { return $this->alive; } public function kill() { if($this->alive) { $this->alive = FALSE; } else { throw new Exception($this->name.' is already dead'); } } } $npc = new Human('John'); if($npc->is_alive()) echo 'John is alive'; $npc->kill(); if( ! $npc->is_alive()) echo 'John isn\'t live anymore';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 8
filename:       /in/fW3H8
function name:  (null)
number of ops:  16
compiled vars:  !0 = $npc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'Human'
          1        SEND_VAL_EX                                              'John'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   30     4        INIT_METHOD_CALL                                         !0, 'is_alive'
          5        DO_FCALL                                      0  $4      
          6      > JMPZ                                                     $4, ->8
   31     7    >   ECHO                                                     'John+is+alive'
   32     8    >   INIT_METHOD_CALL                                         !0, 'kill'
          9        DO_FCALL                                      0          
   33    10        INIT_METHOD_CALL                                         !0, 'is_alive'
         11        DO_FCALL                                      0  $6      
         12        BOOL_NOT                                         ~7      $6
         13      > JMPZ                                                     ~7, ->15
   34    14    >   ECHO                                                     'John+isn%27t+live+anymore'
         15    > > RETURN                                                   1

Class Human:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fW3H8
function name:  __construct
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      null
    9     1        JMP_SET                                          ~2      !0, ->3
          2        QM_ASSIGN                                        ~2      'Person'
          3        ASSIGN_OBJ                                               'name'
          4        OP_DATA                                                  ~2
   10     5      > RETURN                                                   null

End of function __construct

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

End of function is_alive

Function kill:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/fW3H8
function name:  kill
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'alive'
          1      > JMPZ                                                     ~0, ->5
   20     2    >   ASSIGN_OBJ                                               'alive'
          3        OP_DATA                                                  <false>
          4      > JMP                                                      ->11
   24     5    >   NEW                                              $2      'Exception'
          6        FETCH_OBJ_R                                      ~3      'name'
          7        CONCAT                                           ~4      ~3, '+is+already+dead'
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $2
   26    11    > > RETURN                                                   null

End of function kill

End of class Human.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.52 ms | 1399 KiB | 13 Q