3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace T ; define('ARGUMENT', uniqid()); function callWithArgs(callable $callback, array $args = []) { return function($param) use($callback, $args) { array_walk($args, function(&$arg) use($param) { $arg === \T\ARGUMENT and $arg = $param; }); return $callback(...$args); }; } $t = callWithArgs('str_replace', ['dolor', 'DOLOR', \T\ARGUMENT]); $string = 'Lorem ipsum dolor simet'; var_dump( $t($string) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjOGD
function name:  (null)
number of ops:  23
compiled vars:  !0 = $t, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_NS_FCALL_BY_NAME                                    'T%5Cdefine'
          1        SEND_VAL_EX                                              'ARGUMENT'
          2        INIT_NS_FCALL_BY_NAME                                    'T%5Cuniqid'
          3        DO_FCALL                                      0  $2      
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
   17     6        INIT_NS_FCALL_BY_NAME                                    'T%5CcallWithArgs'
          7        SEND_VAL_EX                                              'str_replace'
          8        INIT_ARRAY                                       ~4      'dolor'
          9        ADD_ARRAY_ELEMENT                                ~4      'DOLOR'
         10        FETCH_CONSTANT                                   ~5      'T%5CARGUMENT'
         11        ADD_ARRAY_ELEMENT                                ~4      ~5
         12        SEND_VAL_EX                                              ~4
         13        DO_FCALL                                      0  $6      
         14        ASSIGN                                                   !0, $6
   19    15        ASSIGN                                                   !1, 'Lorem+ipsum+dolor+simet'
   21    16        INIT_NS_FCALL_BY_NAME                                    'T%5Cvar_dump'
         17        INIT_DYNAMIC_CALL                                        !0
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $9      
         20        SEND_VAR_NO_REF_EX                                       $9
         21        DO_FCALL                                      0          
         22      > RETURN                                                   1

Function t%5Ccallwithargs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjOGD
function name:  T\callWithArgs
number of ops:  7
compiled vars:  !0 = $callback, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    8     2        DECLARE_LAMBDA_FUNCTION                                  '%00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A8%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
   14     5      > RETURN                                                   ~2
   15     6*     > RETURN                                                   null

End of function t%5Ccallwithargs

Function %00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjOGD
function name:  T\{closure}
number of ops:  15
compiled vars:  !0 = $param, !1 = $callback, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    9     3        INIT_NS_FCALL_BY_NAME                                    'T%5Carray_walk'
          4        SEND_VAR_EX                                              !2
          5        DECLARE_LAMBDA_FUNCTION                                  '%00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A9%241'
          6        BIND_LEXICAL                                             ~3, !0
   11     7        SEND_VAL_EX                                              ~3
          8        DO_FCALL                                      0          
   13     9        INIT_DYNAMIC_CALL                                        !1
         10        SEND_UNPACK                                              !2
         11        CHECK_UNDEF_ARGS                                         
         12        DO_FCALL                                      1  $5      
         13      > RETURN                                                   $5
   14    14*     > RETURN                                                   null

End of function %00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A8%240

Function %00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A9%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/mjOGD
function name:  T\{closure}
number of ops:  8
compiled vars:  !0 = $arg, !1 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        FETCH_CONSTANT                                   ~2      'T%5CARGUMENT'
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4      > JMPZ_EX                                          ~3      ~3, ->7
          5    >   ASSIGN                                           ~4      !0, !1
          6        BOOL                                             ~3      ~4
   11     7    > > RETURN                                                   null

End of function %00t%5C%7Bclosure%7D%2Fin%2FmjOGD%3A9%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.6 ms | 1394 KiB | 22 Q