3v4l.org

run code in 300+ PHP versions simultaneously
<?php $checksum = crc32("The quick brown fox jumped over the lazy dog."); $outstring = ''; $l = strlen($data); for ($i = 0; $i < $l; $i += 8) { $chunk = substr($data, $i, 8); $outlen = ceil((strlen($chunk) * 8)/6); //8bit/char in, 6bits/char out, round up $x = bin2hex($chunk); //gmp won't convert from binary, so go via hex $w = gmp_strval(gmp_init(ltrim($x, '0'), 16), 62); //gmp doesn't like leading 0s $pad = str_pad($w, $outlen, '0', STR_PAD_LEFT); $outstring .= $pad; } echo $outstring; printf("%u\n", $checksum);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 9
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 9
Branch analysis from position: 50
Branch analysis from position: 9
filename:       /in/CoY5T
function name:  (null)
number of ops:  56
compiled vars:  !0 = $checksum, !1 = $outstring, !2 = $l, !3 = $data, !4 = $i, !5 = $chunk, !6 = $outlen, !7 = $x, !8 = $w, !9 = $pad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'crc32'
          1        SEND_VAL                                                 'The+quick+brown+fox+jumped+over+the+lazy+dog.'
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !0, $10
    5     4        ASSIGN                                                   !1, ''
    6     5        STRLEN                                           ~13     !3
          6        ASSIGN                                                   !2, ~13
    7     7        ASSIGN                                                   !4, 0
          8      > JMP                                                      ->48
    8     9    >   INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !4
         12        SEND_VAL                                                 8
         13        DO_ICALL                                         $16     
         14        ASSIGN                                                   !5, $16
    9    15        INIT_FCALL                                               'ceil'
         16        STRLEN                                           ~18     !5
         17        MUL                                              ~19     ~18, 8
         18        DIV                                              ~20     ~19, 6
         19        SEND_VAL                                                 ~20
         20        DO_ICALL                                         $21     
         21        ASSIGN                                                   !6, $21
   10    22        INIT_FCALL                                               'bin2hex'
         23        SEND_VAR                                                 !5
         24        DO_ICALL                                         $23     
         25        ASSIGN                                                   !7, $23
   11    26        INIT_FCALL_BY_NAME                                       'gmp_strval'
         27        INIT_FCALL_BY_NAME                                       'gmp_init'
         28        INIT_FCALL                                               'ltrim'
         29        SEND_VAR                                                 !7
         30        SEND_VAL                                                 '0'
         31        DO_ICALL                                         $25     
         32        SEND_VAR_NO_REF_EX                                       $25
         33        SEND_VAL_EX                                              16
         34        DO_FCALL                                      0  $26     
         35        SEND_VAR_NO_REF_EX                                       $26
         36        SEND_VAL_EX                                              62
         37        DO_FCALL                                      0  $27     
         38        ASSIGN                                                   !8, $27
   12    39        INIT_FCALL                                               'str_pad'
         40        SEND_VAR                                                 !8
         41        SEND_VAR                                                 !6
         42        SEND_VAL                                                 '0'
         43        SEND_VAL                                                 0
         44        DO_ICALL                                         $29     
         45        ASSIGN                                                   !9, $29
   13    46        ASSIGN_OP                                     8          !1, !9
    7    47        ASSIGN_OP                                     1          !4, 8
         48    >   IS_SMALLER                                               !4, !2
         49      > JMPNZ                                                    ~33, ->9
   16    50    >   ECHO                                                     !1
   18    51        INIT_FCALL                                               'printf'
         52        SEND_VAL                                                 '%25u%0A'
         53        SEND_VAR                                                 !0
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.07 ms | 1405 KiB | 27 Q