3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); $packed = pack('N', 32767); for ($i=0; $i<strlen($packed); $i++) { $arr[$i] = ord($packed[$i]); } print_r($arr); /* function pack_encode($val) { $b64 = base64_encode(pack($format, $val)); return str_replace(array('/', '='), array('_', ''), $b64); // "/" json-encodes poorly and "=" is padding } function pack_decode($bin) { $b64 = str_replace('_', '/', $bin); // un-padded $data = unpack('C'.(length($bin)/2), base64_decode($b64, false)); $val = 0; foreach ($data as $v) { $val = ($val<<$width) | $v; } return $val; } $max = 32767; $n = 20; $step = intval($max/$n); for ($i=0; $i<=$n; $i++) { $val = $i*$step; $enc = pack_encode($val); $dec = pack_decode($val); echo "$enc $dec $val\n"; } */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename:       /in/PO9vL
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr, !1 = $packed, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'pack'
          2        SEND_VAL                                                 'N'
          3        SEND_VAL                                                 32767
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->15
    6     8    >   INIT_FCALL                                               'ord'
          9        FETCH_DIM_R                                      ~8      !1, !2
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        ASSIGN_DIM                                               !0, !2
         13        OP_DATA                                                  $9
    5    14        PRE_INC                                                  !2
         15    >   STRLEN                                           ~11     !1
         16        IS_SMALLER                                               !2, ~11
         17      > JMPNZ                                                    ~12, ->8
    8    18    >   INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   35    21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.16 ms | 1395 KiB | 19 Q