3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { protected $id; protected $some_val; const BAR_TYPE_FOO = 1; const BAR_TYPE_DANG = 2; function getByRow($row) { $node = null; switch ($row['type']) { case Bar::BAR_TYPE_FOO: $node = new FooBar; break; case Bar::BAR_TYPE_DANG: $node = new DangBar; break; default: break; } $node->loadRow($row); return $node; } function loadRow(array $row) { $this->id = $row['id']; $this->some_val = $row['some_val']; } } class FooBar extends Bar { protected $fooVal; function loadRow(array $row) { parent::loadRow($row); $this->fooVal = $row['foo_val']; } } class DangBar extends Bar { protected $dangVal; function loadRow(array $row) { parent::loadRow($row); $this->fooVal = $row['dang_val']; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoQo5
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E > > RETURN                                                   1

Class Bar:
Function getbyrow:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
filename:       /in/IoQo5
function name:  getByRow
number of ops:  23
compiled vars:  !0 = $row, !1 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, null
   13     2        FETCH_DIM_R                                      ~3      !0, 'type'
          3        CASE                                                     ~3, 1
          4      > JMPNZ                                                    ~4, ->8
          5    >   CASE                                                     ~3, 2
          6      > JMPNZ                                                    ~4, ->12
          7    > > JMP                                                      ->16
   15     8    >   NEW                                              $5      'FooBar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   16    11      > JMP                                                      ->17
   18    12    >   NEW                                              $8      'DangBar'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   19    15      > JMP                                                      ->17
   21    16    > > JMP                                                      ->17
         17    >   FREE                                                     ~3
   23    18        INIT_METHOD_CALL                                         !1, 'loadRow'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
   24    21      > RETURN                                                   !1
   25    22*     > RETURN                                                   null

End of function getbyrow

Function loadrow:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoQo5
function name:  loadRow
number of ops:  8
compiled vars:  !0 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        FETCH_DIM_R                                      ~2      !0, 'id'
          2        ASSIGN_OBJ                                               'id'
          3        OP_DATA                                                  ~2
   29     4        FETCH_DIM_R                                      ~4      !0, 'some_val'
          5        ASSIGN_OBJ                                               'some_val'
          6        OP_DATA                                                  ~4
   30     7      > RETURN                                                   null

End of function loadrow

End of class Bar.

Class FooBar:
Function loadrow:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoQo5
function name:  loadRow
number of ops:  8
compiled vars:  !0 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   38     1        INIT_STATIC_METHOD_CALL                                  'loadRow'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   39     4        FETCH_DIM_R                                      ~3      !0, 'foo_val'
          5        ASSIGN_OBJ                                               'fooVal'
          6        OP_DATA                                                  ~3
   40     7      > RETURN                                                   null

End of function loadrow

Function getbyrow:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
filename:       /in/IoQo5
function name:  getByRow
number of ops:  23
compiled vars:  !0 = $row, !1 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, null
   13     2        FETCH_DIM_R                                      ~3      !0, 'type'
          3        CASE                                                     ~3, 1
          4      > JMPNZ                                                    ~4, ->8
          5    >   CASE                                                     ~3, 2
          6      > JMPNZ                                                    ~4, ->12
          7    > > JMP                                                      ->16
   15     8    >   NEW                                              $5      'FooBar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   16    11      > JMP                                                      ->17
   18    12    >   NEW                                              $8      'DangBar'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   19    15      > JMP                                                      ->17
   21    16    > > JMP                                                      ->17
         17    >   FREE                                                     ~3
   23    18        INIT_METHOD_CALL                                         !1, 'loadRow'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
   24    21      > RETURN                                                   !1
   25    22*     > RETURN                                                   null

End of function getbyrow

End of class FooBar.

Class DangBar:
Function loadrow:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoQo5
function name:  loadRow
number of ops:  8
compiled vars:  !0 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
   48     1        INIT_STATIC_METHOD_CALL                                  'loadRow'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   49     4        FETCH_DIM_R                                      ~3      !0, 'dang_val'
          5        ASSIGN_OBJ                                               'fooVal'
          6        OP_DATA                                                  ~3
   50     7      > RETURN                                                   null

End of function loadrow

Function getbyrow:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
filename:       /in/IoQo5
function name:  getByRow
number of ops:  23
compiled vars:  !0 = $row, !1 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, null
   13     2        FETCH_DIM_R                                      ~3      !0, 'type'
          3        CASE                                                     ~3, 1
          4      > JMPNZ                                                    ~4, ->8
          5    >   CASE                                                     ~3, 2
          6      > JMPNZ                                                    ~4, ->12
          7    > > JMP                                                      ->16
   15     8    >   NEW                                              $5      'FooBar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   16    11      > JMP                                                      ->17
   18    12    >   NEW                                              $8      'DangBar'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   19    15      > JMP                                                      ->17
   21    16    > > JMP                                                      ->17
         17    >   FREE                                                     ~3
   23    18        INIT_METHOD_CALL                                         !1, 'loadRow'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
   24    21      > RETURN                                                   !1
   25    22*     > RETURN                                                   null

End of function getbyrow

End of class DangBar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.64 ms | 1407 KiB | 13 Q