3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Globock { trait JSON { function json_encode($data) { return 'json_encode mock'; } } } namespace Acme { //use \Globock\JSON; class Foo { use \Globock\JSON; public function hello() { return json_encode([]); } } } namespace Acme\Test { use Acme\Foo; 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/3XHuH
function name:  (null)
number of ops:  7
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'acme%5Cfoo'
   33     1        NEW                                              $1      'Acme%5CTest%5CFooTest'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   34     4        INIT_METHOD_CALL                                         !0, 'helloTest'
          5        DO_FCALL                                      0          
   35     6      > 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/3XHuH
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/3XHuH
function name:  hello
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_NS_FCALL_BY_NAME                                    'Acme%5Cjson_encode'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
   16     4*     > RETURN                                                   null

End of function hello

End of class Acme\Foo.

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

End of function hellotest

End of class Acme\Test\FooTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.89 ms | 1388 KiB | 15 Q