3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Stuff { function __invoke() { return 'I am ' . get_class($this) . '.'; } } class Thing { function __invoke() { return 'I am Thing.'; } } class Thang { use Stuff; } $things[] = function () { return 'I am Thong.'; }; $things[] = new Thing; $things[] = new Thang; $things[] = 'strlen'; $things[] = [$thing1, '__invoke']; $things[] = [$thang1, '__invoke']; var_dump(array_map('is_callable'), $things);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MQ4YH
function name:  (null)
number of ops:  30
compiled vars:  !0 = $things, !1 = $thing1, !2 = $thang1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'thang'
    6     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMQ4YH%3A6%241'
          2        ASSIGN_DIM                                               !0
          3        OP_DATA                                                  ~4
    7     4        NEW                                              $6      'Thing'
          5        DO_FCALL                                      0          
          6        ASSIGN_DIM                                               !0
          7        OP_DATA                                                  $6
    8     8        NEW                                              $9      'Thang'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $9
    9    12        ASSIGN_DIM                                               !0
         13        OP_DATA                                                  'strlen'
   10    14        INIT_ARRAY                                       ~13     !1
         15        ADD_ARRAY_ELEMENT                                ~13     '__invoke'
         16        ASSIGN_DIM                                               !0
         17        OP_DATA                                                  ~13
   11    18        INIT_ARRAY                                       ~15     !2
         19        ADD_ARRAY_ELEMENT                                ~15     '__invoke'
         20        ASSIGN_DIM                                               !0
         21        OP_DATA                                                  ~15
   13    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'array_map'
         24        SEND_VAL                                                 'is_callable'
         25        DO_ICALL                                         $16     
         26        SEND_VAR                                                 $16
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FMQ4YH%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MQ4YH
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'I+am+Thong.'
          1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMQ4YH%3A6%241

Class Stuff:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MQ4YH
function name:  __invoke
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      'I+am+', ~1
          3        CONCAT                                           ~3      ~2, '.'
          4      > RETURN                                                   ~3
          5*     > RETURN                                                   null

End of function __invoke

End of class Stuff.

Class Thing:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MQ4YH
function name:  __invoke
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   'I+am+Thing.'
          1*     > RETURN                                                   null

End of function __invoke

End of class Thing.

Class Thang: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.59 ms | 1400 KiB | 17 Q