3v4l.org

run code in 300+ PHP versions simultaneously
<?php class mother { function setStatic( $prop, $val ) { // After this, self:: refers to mother, yet next $class refers to... // $class = get_class( $this ); eval( "$class::\$$prop = \$$val;" ); } } class child extends mother { protected static $sProp; function writer( $value ) { parent::setStatic( 'sProp', $value ); } function reader() { return self::$sProp; } } $c = new child(); $c->writer( 3 ); echo $c->reader(); // 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiJL6
function name:  (null)
number of ops:  10
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'child'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'writer'
          4        SEND_VAL_EX                                              3
          5        DO_FCALL                                      0          
   27     6        INIT_METHOD_CALL                                         !0, 'reader'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Class mother:
Function setstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiJL6
function name:  setStatic
number of ops:  13
compiled vars:  !0 = $prop, !1 = $val, !2 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        FETCH_THIS                                       ~3      
          3        GET_CLASS                                        ~4      ~3
          4        ASSIGN                                                   !2, ~4
    8     5        ROPE_INIT                                     6  ~7      !2
          6        ROPE_ADD                                      1  ~7      ~7, '%3A%3A%24'
          7        ROPE_ADD                                      2  ~7      ~7, !0
          8        ROPE_ADD                                      3  ~7      ~7, '+%3D+%24'
          9        ROPE_ADD                                      4  ~7      ~7, !1
         10        ROPE_END                                      5  ~6      ~7, '%3B'
         11        INCLUDE_OR_EVAL                                          ~6, EVAL
    9    12      > RETURN                                                   null

End of function setstatic

End of class mother.

Class child:
Function writer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiJL6
function name:  writer
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_STATIC_METHOD_CALL                                  'setStatic'
          2        SEND_VAL_EX                                              'sProp'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   18     5      > RETURN                                                   null

End of function writer

Function reader:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiJL6
function name:  reader
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'sProp'
          1      > RETURN                                                   ~0
   22     2*     > RETURN                                                   null

End of function reader

Function setstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BiJL6
function name:  setStatic
number of ops:  13
compiled vars:  !0 = $prop, !1 = $val, !2 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        FETCH_THIS                                       ~3      
          3        GET_CLASS                                        ~4      ~3
          4        ASSIGN                                                   !2, ~4
    8     5        ROPE_INIT                                     6  ~7      !2
          6        ROPE_ADD                                      1  ~7      ~7, '%3A%3A%24'
          7        ROPE_ADD                                      2  ~7      ~7, !0
          8        ROPE_ADD                                      3  ~7      ~7, '+%3D+%24'
          9        ROPE_ADD                                      4  ~7      ~7, !1
         10        ROPE_END                                      5  ~6      ~7, '%3B'
         11        INCLUDE_OR_EVAL                                          ~6, EVAL
    9    12      > RETURN                                                   null

End of function setstatic

End of class child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.46 ms | 1399 KiB | 13 Q