3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); abstract class Father { private static $childs = array(); public static function getChild( $child ) { if (!array_key_exists("$child", self::$childs)) { self::$childs["$child"] = new $child; } return self::$childs["$child"]; } public function __destruct() { foreach (self::$childs as $i => $child) { self::$childs[$i] = $child = null; } } } class Child1 extends Father {} class Child2 extends Father {} $child1 = Father::getChild('Child1'); $child2 = Father::getChild('Child2');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G7UDr
function name:  (null)
number of ops:  12
compiled vars:  !0 = $child1, !1 = $child2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   24     3        INIT_STATIC_METHOD_CALL                                  'Father', 'getChild'
          4        SEND_VAL                                                 'Child1'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
   25     7        INIT_STATIC_METHOD_CALL                                  'Father', 'getChild'
          8        SEND_VAL                                                 'Child2'
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !1, $5
         11      > RETURN                                                   1

Class Father:
Function getchild:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/G7UDr
function name:  getChild
number of ops:  18
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        CAST                                          6  ~1      !0
          2        FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          3        ARRAY_KEY_EXISTS                                 ~3      ~1, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->13
    9     6    >   CAST                                          6  ~6      !0
          7        FETCH_CLASS                                   0  $8      !0
          8        NEW                                              $9      $8
          9        DO_FCALL                                      0          
         10        FETCH_STATIC_PROP_W          unknown             $5      'childs'
         11        ASSIGN_DIM                                               $5, ~6
         12        OP_DATA                                                  $9
   11    13    >   CAST                                          6  ~12     !0
         14        FETCH_STATIC_PROP_R          unknown             ~11     'childs'
         15        FETCH_DIM_R                                      ~13     ~11, ~12
         16      > RETURN                                                   ~13
   12    17*     > RETURN                                                   null

End of function getchild

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/G7UDr
function name:  __destruct
number of ops:  11
compiled vars:  !0 = $child, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          1      > FE_RESET_R                                       $3      ~2, ->9
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->9
          3    >   ASSIGN                                                   !1, ~4
   16     4        ASSIGN                                           ~8      !0, null
          5        FETCH_STATIC_PROP_W          unknown             $6      'childs'
          6        ASSIGN_DIM                                               $6, !1
          7        OP_DATA                                                  ~8
   15     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $3
   18    10      > RETURN                                                   null

End of function __destruct

End of class Father.

Class Child1:
Function getchild:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/G7UDr
function name:  getChild
number of ops:  18
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        CAST                                          6  ~1      !0
          2        FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          3        ARRAY_KEY_EXISTS                                 ~3      ~1, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->13
    9     6    >   CAST                                          6  ~6      !0
          7        FETCH_CLASS                                   0  $8      !0
          8        NEW                                              $9      $8
          9        DO_FCALL                                      0          
         10        FETCH_STATIC_PROP_W          unknown             $5      'childs'
         11        ASSIGN_DIM                                               $5, ~6
         12        OP_DATA                                                  $9
   11    13    >   CAST                                          6  ~12     !0
         14        FETCH_STATIC_PROP_R          unknown             ~11     'childs'
         15        FETCH_DIM_R                                      ~13     ~11, ~12
         16      > RETURN                                                   ~13
   12    17*     > RETURN                                                   null

End of function getchild

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/G7UDr
function name:  __destruct
number of ops:  11
compiled vars:  !0 = $child, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          1      > FE_RESET_R                                       $3      ~2, ->9
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->9
          3    >   ASSIGN                                                   !1, ~4
   16     4        ASSIGN                                           ~8      !0, null
          5        FETCH_STATIC_PROP_W          unknown             $6      'childs'
          6        ASSIGN_DIM                                               $6, !1
          7        OP_DATA                                                  ~8
   15     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $3
   18    10      > RETURN                                                   null

End of function __destruct

End of class Child1.

Class Child2:
Function getchild:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/G7UDr
function name:  getChild
number of ops:  18
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        CAST                                          6  ~1      !0
          2        FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          3        ARRAY_KEY_EXISTS                                 ~3      ~1, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->13
    9     6    >   CAST                                          6  ~6      !0
          7        FETCH_CLASS                                   0  $8      !0
          8        NEW                                              $9      $8
          9        DO_FCALL                                      0          
         10        FETCH_STATIC_PROP_W          unknown             $5      'childs'
         11        ASSIGN_DIM                                               $5, ~6
         12        OP_DATA                                                  $9
   11    13    >   CAST                                          6  ~12     !0
         14        FETCH_STATIC_PROP_R          unknown             ~11     'childs'
         15        FETCH_DIM_R                                      ~13     ~11, ~12
         16      > RETURN                                                   ~13
   12    17*     > RETURN                                                   null

End of function getchild

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/G7UDr
function name:  __destruct
number of ops:  11
compiled vars:  !0 = $child, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_STATIC_PROP_R          unknown             ~2      'childs'
          1      > FE_RESET_R                                       $3      ~2, ->9
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->9
          3    >   ASSIGN                                                   !1, ~4
   16     4        ASSIGN                                           ~8      !0, null
          5        FETCH_STATIC_PROP_W          unknown             $6      'childs'
          6        ASSIGN_DIM                                               $6, !1
          7        OP_DATA                                                  ~8
   15     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $3
   18    10      > RETURN                                                   null

End of function __destruct

End of class Child2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.36 ms | 1408 KiB | 15 Q