3v4l.org

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

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