3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encode($str) { $str = mb_convert_encoding($str , 'UTF-32', 'UTF-8'); //big endian $split = str_split($str, 4); $res = ""; foreach ($split as $c) { $cur = 0; for ($i = 0; $i < 4; $i++) { $cur |= ord($c[$i]) << (8*(3 - $i)); } $res .= "&#" . $cur . ";"; } return $res; } echo encode("mailto:liisa@finnanimation.fi");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBiC6
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'encode'
          1        SEND_VAL                                                 'mailto%3Aliisa%40finnanimation.fi'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function encode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 33
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 33
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
Branch analysis from position: 18
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/nBiC6
function name:  encode
number of ops:  36
compiled vars:  !0 = $str, !1 = $split, !2 = $res, !3 = $c, !4 = $cur, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'mb_convert_encoding'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'UTF-32'
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !0, $6
    4     7        INIT_FCALL                                               'str_split'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 4
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !1, $8
    6    12        ASSIGN                                                   !2, ''
    7    13      > FE_RESET_R                                       $11     !1, ->33
         14    > > FE_FETCH_R                                               $11, !3, ->33
    8    15    >   ASSIGN                                                   !4, 0
    9    16        ASSIGN                                                   !5, 0
         17      > JMP                                                      ->27
   10    18    >   INIT_FCALL                                               'ord'
         19        FETCH_DIM_R                                      ~14     !3, !5
         20        SEND_VAL                                                 ~14
         21        DO_ICALL                                         $15     
         22        SUB                                              ~16     3, !5
         23        MUL                                              ~17     ~16, 8
         24        SL                                               ~18     $15, ~17
         25        ASSIGN_OP                                     9          !4, ~18
    9    26        PRE_INC                                                  !5
         27    >   IS_SMALLER                                               !5, 4
         28      > JMPNZ                                                    ~21, ->18
   12    29    >   CONCAT                                           ~22     '%26%23', !4
         30        CONCAT                                           ~23     ~22, '%3B'
         31        ASSIGN_OP                                     8          !2, ~23
    7    32      > JMP                                                      ->14
         33    >   FE_FREE                                                  $11
   14    34      > RETURN                                                   !2
   15    35*     > RETURN                                                   null

End of function encode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.97 ms | 1402 KiB | 20 Q