3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Globock { trait JSON { function json_encode($data) { return 'json_encode mock'; } } } namespace Acme { class Foo { use \Globock\JSON; public function hello() { return json_encode([]); } } } namespace Acme\Test { use Acme\Foo as BaseFoo; class Foo extends BaseFoo { use \Globock\JSON; } class FooTest { public function helloTest() { $a = new Foo(); echo $a->hello(); } } } namespace { //$a = new Acme\Foo(); //echo $a->hello(); $b = new Acme\Test\FooTest(); $b->helloTest(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/spvLg
function name:  (null)
number of ops:  8
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'acme%5Cfoo'
   21     1        DECLARE_CLASS                                            'acme%5Ctest%5Cfoo', 'acme%5Cfoo'
   35     2        NEW                                              $1      'Acme%5CTest%5CFooTest'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   36     5        INIT_METHOD_CALL                                         !0, 'helloTest'
          6        DO_FCALL                                      0          
   37     7      > RETURN                                                   1

Class Globock\JSON:
Function json_encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/spvLg
function name:  json_encode
number of ops:  3
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > RETURN                                                   'json_encode+mock'
    6     2*     > RETURN                                                   null

End of function json_encode

End of class Globock\JSON.

Class Acme\Foo:
Function hello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/spvLg
function name:  hello
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_NS_FCALL_BY_NAME                                    'Acme%5Cjson_encode'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
   15     4*     > RETURN                                                   null

End of function hello

End of class Acme\Foo.

Class Acme\Test\Foo: [no user functions]
Class Acme\Test\FooTest:
Function hellotest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/spvLg
function name:  helloTest
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'Acme%5CTest%5CFoo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   27     3        INIT_METHOD_CALL                                         !0, 'hello'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   28     6      > RETURN                                                   null

End of function hellotest

End of class Acme\Test\FooTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.22 ms | 1396 KiB | 15 Q