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 __CLASS__; } public static function add($value) { self::$currentValue = self::$currentValue + $value; return __CLASS__; } public static function subtract($value) { self::$currentValue = self::$currentValue - $value; return __CLASS__; } public static function result() { return self::$currentValue; } } $value = TestClass::toValue(5)::add(3)::subtract(2)::add(8)::result(); echo $value;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XH42Y
function name:  (null)
number of ops:  21
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, 'subtract'
          9        SEND_VAL_EX                                              2
         10        DO_FCALL                                      0  $5      
         11        FETCH_CLASS                                   0  $6      $5
         12        INIT_STATIC_METHOD_CALL                                  $6, 'add'
         13        SEND_VAL_EX                                              8
         14        DO_FCALL                                      0  $7      
         15        FETCH_CLASS                                   0  $8      $7
         16        INIT_STATIC_METHOD_CALL                                  $8, 'result'
         17        DO_FCALL                                      0  $9      
         18        ASSIGN                                                   !0, $9
   29    19        ECHO                                                     !0
         20      > RETURN                                                   1

Class TestClass:
Function tovalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XH42Y
function name:  toValue
number of ops:  5
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      > RETURN                                                   'TestClass'
   10     4*     > 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/XH42Y
function name:  add
number of ops:  7
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      > RETURN                                                   'TestClass'
   15     6*     > 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/XH42Y
function name:  subtract
number of ops:  7
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      > RETURN                                                   'TestClass'
   20     6*     > 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/XH42Y
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:
125.02 ms | 1445 KiB | 13 Q