3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class TestClass { public static $currentValue; public static function toValue($value) { self::$currentValue = $value; return static::class; } public static function add($value) { self::$currentValue = self::$currentValue + $value; return static::class; } public static function subtract($value) { self::$currentValue = self::$currentValue - $value; return static::class; } public static function result() { return self::$currentValue; } } $value = TestClass::toValue(5)::add(3)::result(); echo $value;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLg7t
function name:  (null)
number of ops:  13
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'TestClass', 'toValue'
          1        SEND_VAL                                                 5
          2        DO_FCALL                                      0  $1      
          3        FETCH_CLASS                                   0  $2      $1
          4        INIT_STATIC_METHOD_CALL                                  $2, 'add'
          5        SEND_VAL_EX                                              3
          6        DO_FCALL                                      0  $3      
          7        FETCH_CLASS                                   0  $4      $3
          8        INIT_STATIC_METHOD_CALL                                  $4, 'result'
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !0, $5
   29    11        ECHO                                                     !0
   30    12      > RETURN                                                   1

Class TestClass:
Function tovalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLg7t
function name:  toValue
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_STATIC_PROP                                       'currentValue'
          2        OP_DATA                                                  !0
    9     3        FETCH_CLASS_NAME                                 ~2      
          4      > RETURN                                                   ~2
   10     5*     > RETURN                                                   null

End of function tovalue

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLg7t
function name:  add
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        FETCH_STATIC_PROP_R          unknown             ~2      'currentValue'
          2        ADD                                              ~3      ~2, !0
          3        ASSIGN_STATIC_PROP                                       'currentValue'
          4        OP_DATA                                                  ~3
   14     5        FETCH_CLASS_NAME                                 ~4      
          6      > RETURN                                                   ~4
   15     7*     > RETURN                                                   null

End of function add

Function subtract:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLg7t
function name:  subtract
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        FETCH_STATIC_PROP_R          unknown             ~2      'currentValue'
          2        SUB                                              ~3      ~2, !0
          3        ASSIGN_STATIC_PROP                                       'currentValue'
          4        OP_DATA                                                  ~3
   19     5        FETCH_CLASS_NAME                                 ~4      
          6      > RETURN                                                   ~4
   20     7*     > RETURN                                                   null

End of function subtract

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

End of function result

End of class TestClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
212.85 ms | 944 KiB | 14 Q