3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { private $x; public function setX($x) { $this->x = $x; return $this; } public function getX() { return $this->x; } } function test() : Foo { return new Foo(); } $x = test()->setX('test'); var_dump($x->getX());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0gBtZ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        INIT_METHOD_CALL                                         $1, 'setX'
          3        SEND_VAL_EX                                              'test'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   27     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'getX'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0gBtZ
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $0      'Foo'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   23     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function test

Class Foo:
Function setx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0gBtZ
function name:  setX
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'x'
          2        OP_DATA                                                  !0
   11     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   12     5*     > RETURN                                                   null

End of function setx

Function getx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0gBtZ
function name:  getX
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'x'
          1      > RETURN                                                   ~0
   17     2*     > RETURN                                                   null

End of function getx

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.8 ms | 1398 KiB | 16 Q