3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bit1_flag= 1 << 7; $bit2_flag= 1 << 6; // (and i know the fugly for loop should be a do{}while() instead, anyone feel free to fix it, idc) for($i=0;$i<PHP_INT_MAX;++$i){ $str=(string)$i; $hash=hash("sha1",$str,true); $ord=ord($hash[0]); if(($ord & $bit1_flag) || ($ord & $bit2_flag)){ continue; } break; } function strtobits(string $str):string{ $ret=""; for($i=0;$i<strlen($str);++$i){ $ord=ord($str[$i]); for($bitnum=7;$bitnum>=0;--$bitnum){ if($ord & (1<<$bitnum)){ $ret.="1"; }else{ $ret.="0"; } } } return $ret; } var_dump($str,strtobits($hash),bin2hex($hash));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 4
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 4
Branch analysis from position: 27
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 21
filename:       /in/uqPru
function name:  (null)
number of ops:  39
compiled vars:  !0 = $bit1_flag, !1 = $bit2_flag, !2 = $i, !3 = $str, !4 = $hash, !5 = $ord
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 128
    4     1        ASSIGN                                                   !1, 64
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->25
    7     4    >   CAST                                          6  ~9      !2
          5        ASSIGN                                                   !3, ~9
    8     6        INIT_FCALL                                               'hash'
          7        SEND_VAL                                                 'sha1'
          8        SEND_VAR                                                 !3
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !4, $11
    9    12        INIT_FCALL                                               'ord'
         13        FETCH_DIM_R                                      ~13     !4, 0
         14        SEND_VAL                                                 ~13
         15        DO_ICALL                                         $14     
         16        ASSIGN                                                   !5, $14
   10    17        BW_AND                                           ~16     !5, !0
         18      > JMPNZ_EX                                         ~16     ~16, ->21
         19    >   BW_AND                                           ~17     !5, !1
         20        BOOL                                             ~16     ~17
         21    > > JMPZ                                                     ~16, ->23
   11    22    > > JMP                                                      ->24
   13    23    > > JMP                                                      ->27
    6    24    >   PRE_INC                                                  !2
         25    >   IS_SMALLER                                               !2, 9223372036854775807
         26      > JMPNZ                                                    ~19, ->4
   30    27    >   INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !3
         29        INIT_FCALL                                               'strtobits'
         30        SEND_VAR                                                 !4
         31        DO_FCALL                                      0  $20     
         32        SEND_VAR                                                 $20
         33        INIT_FCALL                                               'bin2hex'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                         $21     
         36        SEND_VAR                                                 $21
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Function strtobits:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 4
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 4
Branch analysis from position: 24
Branch analysis from position: 4
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
Branch analysis from position: 11
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
Branch analysis from position: 11
filename:       /in/uqPru
function name:  strtobits
number of ops:  28
compiled vars:  !0 = $str, !1 = $ret, !2 = $i, !3 = $ord, !4 = $bitnum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN                                                   !1, ''
   18     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->21
   19     4    >   INIT_FCALL                                               'ord'
          5        FETCH_DIM_R                                      ~7      !0, !2
          6        SEND_VAL                                                 ~7
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
   20     9        ASSIGN                                                   !4, 7
         10      > JMP                                                      ->18
   21    11    >   SL                                               ~11     1, !4
         12        BW_AND                                           ~12     !3, ~11
         13      > JMPZ                                                     ~12, ->16
   22    14    >   ASSIGN_OP                                     8          !1, '1'
         15      > JMP                                                      ->17
   24    16    >   ASSIGN_OP                                     8          !1, '0'
   20    17    >   PRE_DEC                                                  !4
         18    >   IS_SMALLER_OR_EQUAL                                      0, !4
         19      > JMPNZ                                                    ~16, ->11
   18    20    >   PRE_INC                                                  !2
         21    >   STRLEN                                           ~18     !0
         22        IS_SMALLER                                               !2, ~18
         23      > JMPNZ                                                    ~19, ->4
   28    24    >   VERIFY_RETURN_TYPE                                       !1
         25      > RETURN                                                   !1
   29    26*       VERIFY_RETURN_TYPE                                       
         27*     > RETURN                                                   null

End of function strtobits

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.35 ms | 1403 KiB | 22 Q