3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyRepo { public function find($id) { return null; } } class Foo { function bar($repository) { $result = $repository->find(100); echo get_class($result); } } $foo = new Foo(); $foo->bar(new MyRepo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IA9QJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   22     3        INIT_METHOD_CALL                                             !0, 'bar'
          4        NEW                                                  $4      'MyRepo'
          5        DO_FCALL                                          0          
          6        SEND_VAR_NO_REF_EX                                           $4
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Class MyRepo:
Function find:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IA9QJ
function name:  find
number of ops:  3
compiled vars:  !0 = $id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    7     1      > RETURN                                                       null
    8     2*     > RETURN                                                       null

End of function find

End of class MyRepo.

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IA9QJ
function name:  bar
number of ops:  8
compiled vars:  !0 = $repository, !1 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   15     1        INIT_METHOD_CALL                                             !0, 'find'
          2        SEND_VAL_EX                                                  100
          3        DO_FCALL                                          0  $2      
          4        ASSIGN                                                       !1, $2
   17     5        GET_CLASS                                            ~4      !1
          6        ECHO                                                         ~4
   18     7      > RETURN                                                       null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.01 ms | 2355 KiB | 13 Q