3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = "this is a test"; $escaped = implode("", array_map(function($char) { if (ctype_alnum($char)) { return $char; } $bytelen = mb_strlen($char, '8bit'); $result = '\\u'; for ($i = 0; $i < $bytelen; $i++) { $result .= str_pad(dechex(ord($char[$i])), 2, '0', STR_PAD_LEFT); } return $result; }, str_split($source, 1))); var_dump($escaped);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5V3U2
function name:  (null)
number of ops:  19
compiled vars:  !0 = $source, !1 = $escaped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'this+is+a+test'
    5     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 ''
          3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5V3U2%3A5%240'
   15     5        SEND_VAL                                                 ~3
          6        INIT_FCALL                                               'str_split'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                         $6      
    5    14        ASSIGN                                                   !1, $6
   17    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F5V3U2%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
Branch analysis from position: 14
filename:       /in/5V3U2
function name:  {closure}
number of ops:  33
compiled vars:  !0 = $char, !1 = $bytelen, !2 = $result, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'ctype_alnum'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4      > JMPZ                                                     $4, ->6
    7     5    > > RETURN                                                   !0
    9     6    >   INIT_FCALL                                               'mb_strlen'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 '8bit'
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !1, $5
   10    11        ASSIGN                                                   !2, '%5Cu'
   11    12        ASSIGN                                                   !3, 0
         13      > JMP                                                      ->29
   12    14    >   INIT_FCALL                                               'str_pad'
         15        INIT_FCALL                                               'dechex'
         16        INIT_FCALL                                               'ord'
         17        FETCH_DIM_R                                      ~9      !0, !3
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                         $11     
         22        SEND_VAR                                                 $11
         23        SEND_VAL                                                 2
         24        SEND_VAL                                                 '0'
         25        SEND_VAL                                                 0
         26        DO_ICALL                                         $12     
         27        ASSIGN_OP                                     8          !2, $12
   11    28        PRE_INC                                                  !3
         29    >   IS_SMALLER                                               !3, !1
         30      > JMPNZ                                                    ~15, ->14
   14    31    > > RETURN                                                   !2
   15    32*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5V3U2%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.13 ms | 1400 KiB | 31 Q