3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pack_decode($format, $val) { } function pack_encode($format, $val) { $base64 = base64_encode(pack($format, $val)); return str_replace(array('/', '='), array('_', ''), $base64); } function pack_encode_uint16($val) { return pack_encode('S', $val); } function pack_encode_uint32($val) { return pack_encode('S', $val); } $max = 32767; $n = 20; $step = intval($max/$n); for ($i=0; $i<=$n; $i++) { $val = $i*$step; $uint16 = pack_encode_uint16($val); $uin326 = pack_encode_uint32($val); $str = base64_encode(strval($val)); echo json_encode("$uint16 $uint32 $str $val") . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 7
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 7
Branch analysis from position: 37
Branch analysis from position: 7
filename:       /in/00QoH
function name:  (null)
number of ops:  38
compiled vars:  !0 = $max, !1 = $n, !2 = $step, !3 = $i, !4 = $val, !5 = $uint16, !6 = $uin326, !7 = $str, !8 = $uint32
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, 32767
   21     1        ASSIGN                                                   !1, 20
   22     2        DIV                                              ~11     !0, !1
          3        CAST                                          4  ~12     ~11
          4        ASSIGN                                                   !2, ~12
   24     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->35
   25     7    >   MUL                                              ~15     !3, !2
          8        ASSIGN                                                   !4, ~15
   26     9        INIT_FCALL                                               'pack_encode_uint16'
         10        SEND_VAR                                                 !4
         11        DO_FCALL                                      0  $17     
         12        ASSIGN                                                   !5, $17
   27    13        INIT_FCALL                                               'pack_encode_uint32'
         14        SEND_VAR                                                 !4
         15        DO_FCALL                                      0  $19     
         16        ASSIGN                                                   !6, $19
   28    17        INIT_FCALL                                               'base64_encode'
         18        CAST                                          6  ~21     !4
         19        SEND_VAL                                                 ~21
         20        DO_ICALL                                         $22     
         21        ASSIGN                                                   !7, $22
   29    22        INIT_FCALL                                               'json_encode'
         23        ROPE_INIT                                     7  ~25     !5
         24        ROPE_ADD                                      1  ~25     ~25, '+'
         25        ROPE_ADD                                      2  ~25     ~25, !8
         26        ROPE_ADD                                      3  ~25     ~25, '+'
         27        ROPE_ADD                                      4  ~25     ~25, !7
         28        ROPE_ADD                                      5  ~25     ~25, '+'
         29        ROPE_END                                      6  ~24     ~25, !4
         30        SEND_VAL                                                 ~24
         31        DO_ICALL                                         $29     
         32        CONCAT                                           ~30     $29, '%0A'
         33        ECHO                                                     ~30
   24    34        PRE_INC                                                  !3
         35    >   IS_SMALLER_OR_EQUAL                                      !3, !1
         36      > JMPNZ                                                    ~32, ->7
   30    37    > > RETURN                                                   1

Function pack_decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00QoH
function name:  pack_decode
number of ops:  3
compiled vars:  !0 = $format, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2      > RETURN                                                   null

End of function pack_decode

Function pack_encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00QoH
function name:  pack_encode
number of ops:  17
compiled vars:  !0 = $format, !1 = $val, !2 = $base64
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'base64_encode'
          3        INIT_FCALL                                               'pack'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !2, $4
    9    10        INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 <array>
         12        SEND_VAL                                                 <array>
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $6      
         15      > RETURN                                                   $6
   10    16*     > RETURN                                                   null

End of function pack_encode

Function pack_encode_uint16:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00QoH
function name:  pack_encode_uint16
number of ops:  7
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'pack_encode'
          2        SEND_VAL                                                 'S'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   14     6*     > RETURN                                                   null

End of function pack_encode_uint16

Function pack_encode_uint32:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00QoH
function name:  pack_encode_uint32
number of ops:  7
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'pack_encode'
          2        SEND_VAL                                                 'S'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   18     6*     > RETURN                                                   null

End of function pack_encode_uint32

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.67 ms | 1407 KiB | 25 Q