3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCharacter($index) { $chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw"; $c = ord(substr($chars, $index % strlen($chars))); return ord(substr($chars, ($index << $c) % strlen($chars))); } function main() { $array = array(176, 52, 608, 855); foreach ($array as $value) { echo "$value: " . getCharacter($value) . "\n"; } } //main(); $index = 855; $chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw"; $length = strlen($chars); $per = $index % $length; $subst = substr($chars, $per); $disp = ord($subst); echo "Length: $length\n"; echo "Perc: $per\n"; echo "Substr: $subst\n"; echo "disp: $disp\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbvIQ
function name:  (null)
number of ops:  32
compiled vars:  !0 = $index, !1 = $chars, !2 = $length, !3 = $per, !4 = $subst, !5 = $disp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, 855
   20     1        ASSIGN                                                   !1, '0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw'
   21     2        STRLEN                                           ~8      !1
          3        ASSIGN                                                   !2, ~8
   22     4        MOD                                              ~10     !0, !2
          5        ASSIGN                                                   !3, ~10
   23     6        INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $12     
         10        ASSIGN                                                   !4, $12
   24    11        INIT_FCALL                                               'ord'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !5, $14
   25    15        ROPE_INIT                                     3  ~17     'Length%3A+'
         16        ROPE_ADD                                      1  ~17     ~17, !2
         17        ROPE_END                                      2  ~16     ~17, '%0A'
         18        ECHO                                                     ~16
   26    19        ROPE_INIT                                     3  ~20     'Perc%3A+'
         20        ROPE_ADD                                      1  ~20     ~20, !3
         21        ROPE_END                                      2  ~19     ~20, '%0A'
         22        ECHO                                                     ~19
   27    23        ROPE_INIT                                     3  ~23     'Substr%3A+'
         24        ROPE_ADD                                      1  ~23     ~23, !4
         25        ROPE_END                                      2  ~22     ~23, '%0A'
         26        ECHO                                                     ~22
   28    27        ROPE_INIT                                     3  ~26     'disp%3A+'
         28        ROPE_ADD                                      1  ~26     ~26, !5
         29        ROPE_END                                      2  ~25     ~26, '%0A'
         30        ECHO                                                     ~25
         31      > RETURN                                                   1

Function getcharacter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbvIQ
function name:  getCharacter
number of ops:  24
compiled vars:  !0 = $index, !1 = $chars, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, '0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw'
    5     2        INIT_FCALL                                               'ord'
          3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !1
          5        STRLEN                                           ~4      !1
          6        MOD                                              ~5      !0, ~4
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
    6    12        INIT_FCALL                                               'ord'
         13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !1
         15        SL                                               ~9      !0, !2
         16        STRLEN                                           ~10     !1
         17        MOD                                              ~11     ~9, ~10
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                         $12     
         20        SEND_VAR                                                 $12
         21        DO_ICALL                                         $13     
         22      > RETURN                                                   $13
    7    23*     > RETURN                                                   null

End of function getcharacter

Function main:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/gbvIQ
function name:  main
number of ops:  14
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1      > FE_RESET_R                                       $3      !0, ->12
          2    > > FE_FETCH_R                                               $3, !1, ->12
   12     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~4      !1, '%3A+'
          5        INIT_FCALL                                               'getcharacter'
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      ~4, $5
          9        CONCAT                                           ~7      ~6, '%0A'
         10        ECHO                                                     ~7
   11    11      > JMP                                                      ->2
         12    >   FE_FREE                                                  $3
   14    13      > RETURN                                                   null

End of function main

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.77 ms | 1403 KiB | 18 Q