3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); /** * Isolated code */ class Bar { public function add(int $numOne, int $numTwo): int { return $numOne + $numTwo; } } /** * Non-Isolated code */ class Foo { private $bar; public function __construct(Bar $bar) { $this->bar = $bar; } public function addFive(int $base): int { return $this->bar->add($base, 5); } } $bar = new Bar(); $foo = new Foo($bar); echo $foo->addFive(9);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ghsY
function name:  (null)
number of ops:  12
compiled vars:  !0 = $bar, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $2      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   36     3        NEW                                              $5      'Foo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   38     7        INIT_METHOD_CALL                                         !1, 'addFive'
          8        SEND_VAL_EX                                              9
          9        DO_FCALL                                      0  $8      
         10        ECHO                                                     $8
         11      > RETURN                                                   1

Class Bar:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ghsY
function name:  add
number of ops:  7
compiled vars:  !0 = $numOne, !1 = $numTwo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        ADD                                              ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
   13     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function add

End of class Bar.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ghsY
function name:  __construct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   26     3      > RETURN                                                   null

End of function __construct

Function addfive:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ghsY
function name:  addFive
number of ops:  10
compiled vars:  !0 = $base
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        FETCH_OBJ_R                                      ~1      'bar'
          2        INIT_METHOD_CALL                                         ~1, 'add'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAL_EX                                              5
          5        DO_FCALL                                      0  $2      
          6        VERIFY_RETURN_TYPE                                       $2
          7      > RETURN                                                   $2
   31     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function addfive

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.69 ms | 1069 KiB | 13 Q