3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface NodeInterface { public function eval() : int; } class Node implements NodeInterface { public int $value; public string $sign; public Node $rightChild; public Node $leftChild; public function eval() { if ($rightChild != null) { return $this->value; } switch ($this->sign) { case "+": return $this->leftChild->value + $this->rightChild->value; //... } } } $root = new Node(); $root->value = 10; echo $root->eval();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GM05J
function name:  (null)
number of ops:  10
compiled vars:  !0 = $root
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'node'
   29     1        NEW                                              $1      'Node'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   30     4        ASSIGN_OBJ                                               !0, 'value'
          5        OP_DATA                                                  10
   31     6        INIT_METHOD_CALL                                         !0, 'eval'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Class NodeInterface:
Function eval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GM05J
function name:  eval
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function eval

End of class NodeInterface.

Class Node:
Function eval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GM05J
function name:  eval
number of ops:  17
compiled vars:  !0 = $rightChild
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   IS_NOT_EQUAL                                             !0, null
          1      > JMPZ                                                     ~1, ->4
   18     2    >   FETCH_OBJ_R                                      ~2      'value'
          3      > RETURN                                                   ~2
   21     4    >   FETCH_OBJ_R                                      ~3      'sign'
   22     5        CASE                                                     ~3, '%2B'
          6      > JMPNZ                                                    ~4, ->8
          7    > > JMP                                                      ->15
   23     8    >   FETCH_OBJ_R                                      ~5      'leftChild'
          9        FETCH_OBJ_R                                      ~6      ~5, 'value'
         10        FETCH_OBJ_R                                      ~7      'rightChild'
         11        FETCH_OBJ_R                                      ~8      ~7, 'value'
         12        ADD                                              ~9      ~6, ~8
         13        FREE                                                     ~3
         14      > RETURN                                                   ~9
         15    >   FREE                                                     ~3
   26    16      > RETURN                                                   null

End of function eval

End of class Node.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.76 ms | 1434 KiB | 13 Q