3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Source: https://bugs.php.net/bug.php?id=54367 class MyObjet implements ArrayAccess { // All the stuff for ArrayAccess public function offsetGet ($offset) { return function ($var) use ($offset) { // here is the problem return sprintf('<%s>%s</%$1s>', $offset, $var); }; } } $a = new MyObjet(); echo $a['p']('foo');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dbSv4
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'myobjet'
   16     1        NEW                                              $1      'MyObjet'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   18     4        FETCH_DIM_R                                      ~4      !0, 'p'
          5        INIT_DYNAMIC_CALL                                        ~4
          6        SEND_VAL_EX                                              'foo'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FdbSv4%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dbSv4
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $var, !1 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 '%3C%25s%3E%25s%3C%2F%25%241s%3E'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   12     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FdbSv4%3A10%240

Class MyObjet:
Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dbSv4
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FdbSv4%3A10%240'
          2        BIND_LEXICAL                                             ~1, !0
   12     3      > RETURN                                                   ~1
   13     4*     > RETURN                                                   null

End of function offsetget

End of class MyObjet.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.11 ms | 1396 KiB | 15 Q