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() : int { if (null != $this->rightChild) { 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/4AJ5t
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/4AJ5t
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 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4AJ5t
function name:  eval
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'rightChild'
          1        IS_NOT_EQUAL                                             ~0, null
          2      > JMPZ                                                     ~1, ->6
   18     3    >   FETCH_OBJ_R                                      ~2      'value'
          4        VERIFY_RETURN_TYPE                                       ~2
          5      > RETURN                                                   ~2
   21     6    >   FETCH_OBJ_R                                      ~3      'sign'
   22     7        CASE                                                     ~3, '%2B'
          8      > JMPNZ                                                    ~4, ->10
          9    > > JMP                                                      ->18
   23    10    >   FETCH_OBJ_R                                      ~5      'leftChild'
         11        FETCH_OBJ_R                                      ~6      ~5, 'value'
         12        FETCH_OBJ_R                                      ~7      'rightChild'
         13        FETCH_OBJ_R                                      ~8      ~7, 'value'
         14        ADD                                              ~9      ~6, ~8
         15        VERIFY_RETURN_TYPE                                       ~9
         16        FREE                                                     ~3
         17      > RETURN                                                   ~9
         18    >   FREE                                                     ~3
   26    19        VERIFY_RETURN_TYPE                                       
         20      > RETURN                                                   null

End of function eval

End of class Node.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.26 ms | 1399 KiB | 13 Q