3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FooCallback { function __invoke(string $first, int $second, stdClass $third) ; } function useACallback(FooCallback $c) { return $c('abc', 1234, (object)[]); } var_dump(useACallback(new class implements FooCallback { function __invoke(string $first, int $second, stdClass $third) { return $second > 12; } }));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nu7IG
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'useacallback'
          2        DECLARE_ANON_CLASS                               <resource>  
          3        NEW                                              $1      $0
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $1
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
   13     9      > RETURN                                                   1

Function useacallback:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nu7IG
function name:  useACallback
number of ops:  9
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_DYNAMIC_CALL                                        !0
          2        SEND_VAL_EX                                              'abc'
          3        SEND_VAL_EX                                              1234
          4        CAST                                          8  ~1      <array>
          5        SEND_VAL_EX                                              ~1
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
    7     8*     > RETURN                                                   null

End of function useacallback

Class FooCallback:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nu7IG
function name:  __invoke
number of ops:  4
compiled vars:  !0 = $first, !1 = $second, !2 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3      > RETURN                                                   null

End of function __invoke

End of class FooCallback.

Class FooCallback@anonymous:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nu7IG
function name:  __invoke
number of ops:  6
compiled vars:  !0 = $first, !1 = $second, !2 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   11     3        IS_SMALLER                                       ~3      12, !1
          4      > RETURN                                                   ~3
   12     5*     > RETURN                                                   null

End of function __invoke

End of class FooCallback@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.79 ms | 1403 KiB | 16 Q