3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static $objcount = 0; public $param =3; function __construct(){ self::$objcount++; } function test(){ echo 'success'; } static function static_test(){ $this->param = 5; echo $this->param; } } var_dump(foo::$objcount); $a = new foo(); var_dump(foo::$objcount); $b = new foo(); var_dump(foo::$objcount); $a->static_test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9cr6l
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_STATIC_PROP_R          global lock         ~2      'objcount'
          2        SEND_VAL                                                 ~2
          3        DO_ICALL                                                 
   22     4        NEW                                              $4      'foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   23     7        INIT_FCALL                                               'var_dump'
          8        FETCH_STATIC_PROP_R          unknown             ~7      'objcount'
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                                 
   24    11        NEW                                              $9      'foo'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !1, $9
   25    14        INIT_FCALL                                               'var_dump'
         15        FETCH_STATIC_PROP_R          unknown             ~12     'objcount'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   26    18        INIT_METHOD_CALL                                         !0, 'static_test'
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9cr6l
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   PRE_INC_STATIC_PROP                                      'objcount'
    9     1      > RETURN                                                   null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9cr6l
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'success'
   13     1      > RETURN                                                   null

End of function test

Function static_test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9cr6l
function name:  static_test
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                               $0, 'param'
          2        OP_DATA                                                  5
   17     3        FETCH_THIS                                       $2      
          4        FETCH_OBJ_R                                      ~3      $2, 'param'
          5        ECHO                                                     ~3
   18     6      > RETURN                                                   null

End of function static_test

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.87 ms | 1392 KiB | 15 Q