3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Doge { private $name; protected $ham; public $yup; public static function factory() { $me = new static(); $me->name = "Cooper"; $me->ham = "Sandwich"; $me->yup = "nope"; return $me; } } class Dogeness extends Doge { public static function factoryOther() { $me = new static(); $me->name = "Cooper"; $me->ham = "Sandwich"; $me->yup = "nope"; return $me; } } $doge = Doge::factory(); var_dump($doge); $dogeness = Dogeness::factory(); var_dump($dogeness); $dogeness = Dogeness::factoryOther(); var_dump($dogeness);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YIDZa
function name:  (null)
number of ops:  19
compiled vars:  !0 = $doge, !1 = $dogeness
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                  'Doge', 'factory'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   28     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   31     6        INIT_STATIC_METHOD_CALL                                  'Dogeness', 'factory'
          7        DO_FCALL                                      0  $5      
          8        ASSIGN                                                   !1, $5
   32     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   33    12        INIT_STATIC_METHOD_CALL                                  'Dogeness', 'factoryOther'
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !1, $8
   34    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Doge:
Function factory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YIDZa
function name:  factory
number of ops:  11
compiled vars:  !0 = $me
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                          static              $1      
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   10     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'Cooper'
   11     5        ASSIGN_OBJ                                               !0, 'ham'
          6        OP_DATA                                                  'Sandwich'
   12     7        ASSIGN_OBJ                                               !0, 'yup'
          8        OP_DATA                                                  'nope'
   13     9      > RETURN                                                   !0
   14    10*     > RETURN                                                   null

End of function factory

End of class Doge.

Class Dogeness:
Function factoryother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YIDZa
function name:  factoryOther
number of ops:  11
compiled vars:  !0 = $me
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                          static              $1      
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'Cooper'
   21     5        ASSIGN_OBJ                                               !0, 'ham'
          6        OP_DATA                                                  'Sandwich'
   22     7        ASSIGN_OBJ                                               !0, 'yup'
          8        OP_DATA                                                  'nope'
   23     9      > RETURN                                                   !0
   24    10*     > RETURN                                                   null

End of function factoryother

Function factory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YIDZa
function name:  factory
number of ops:  11
compiled vars:  !0 = $me
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                          static              $1      
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   10     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'Cooper'
   11     5        ASSIGN_OBJ                                               !0, 'ham'
          6        OP_DATA                                                  'Sandwich'
   12     7        ASSIGN_OBJ                                               !0, 'yup'
          8        OP_DATA                                                  'nope'
   13     9      > RETURN                                                   !0
   14    10*     > RETURN                                                   null

End of function factory

End of class Dogeness.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.13 ms | 1400 KiB | 15 Q