3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dumpParameter($r){ return 'PAR'.$r.'AM'; } function t($value){ if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (Boolean, integer, ...) // the preg_replace_callback converts them to strings return dumpParameter(strtolower($match[1])); } else { $replaceParameters = function ($match){ return "'.".dumpParameter(strtolower($match[2])).".'"; }; $code = str_replace('%%', '%', preg_replace_callback('/(?<!%)(%)([^%]+)\1/', $replaceParameters, var_export($value, true))); return $code; } } t('%ddd%dre');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZYKHJ
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               't'
          1        SEND_VAL                                                 '%25ddd%25dre'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function dumpparameter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZYKHJ
function name:  dumpParameter
number of ops:  5
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        CONCAT                                           ~1      'PAR', !0
          2        CONCAT                                           ~2      ~1, 'AM'
          3      > RETURN                                                   ~2
    5     4*     > RETURN                                                   null

End of function dumpparameter

Function t:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZYKHJ
function name:  t
number of ops:  35
compiled vars:  !0 = $value, !1 = $match, !2 = $replaceParameters, !3 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5E%25%28%5B%5E%25%5D%2B%29%25%24%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $4      
          6      > JMPZ                                                     $4, ->16
   13     7    >   INIT_FCALL                                               'dumpparameter'
          8        INIT_FCALL                                               'strtolower'
          9        FETCH_DIM_R                                      ~5      !1, 1
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        DO_FCALL                                      0  $7      
         14      > RETURN                                                   $7
         15*       JMP                                                      ->34
   15    16    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZYKHJ%3A15%240'
         17        ASSIGN                                                   !2, ~8
   19    18        INIT_FCALL                                               'str_replace'
         19        SEND_VAL                                                 '%25%25'
         20        SEND_VAL                                                 '%25'
         21        INIT_FCALL                                               'preg_replace_callback'
         22        SEND_VAL                                                 '%2F%28%3F%3C%21%25%29%28%25%29%28%5B%5E%25%5D%2B%29%5C1%2F'
         23        SEND_VAR                                                 !2
         24        INIT_FCALL                                               'var_export'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $10     
         28        SEND_VAR                                                 $10
         29        DO_ICALL                                         $11     
         30        SEND_VAR                                                 $11
         31        DO_ICALL                                         $12     
         32        ASSIGN                                                   !3, $12
   20    33      > RETURN                                                   !3
   23    34*     > RETURN                                                   null

End of function t

Function %00%7Bclosure%7D%2Fin%2FZYKHJ%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZYKHJ
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'dumpparameter'
          2        INIT_FCALL                                               'strtolower'
          3        FETCH_DIM_R                                      ~1      !0, 2
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_FCALL                                      0  $3      
          8        CONCAT                                           ~4      '%27.', $3
          9        CONCAT                                           ~5      ~4, '.%27'
         10      > RETURN                                                   ~5
   17    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FZYKHJ%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.54 ms | 1403 KiB | 26 Q