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))); return ($index << $c) & 0xffffff; } function main() { $array = array(176, 52, 608, 855); foreach ($array as $value) { echo "$value: " . getCharacter($value) . "\n"; } } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVE8h
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'main'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function getcharacter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVE8h
function name:  getCharacter
number of ops:  16
compiled vars:  !0 = $index, !1 = $chars, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, '0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw'
    4     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        SL                                               ~9      !0, !2
         13        BW_AND                                           ~10     ~9, 16777215
         14      > RETURN                                                   ~10
    7    15*     > 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/FVE8h
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:
161.04 ms | 1402 KiB | 19 Q