3v4l.org

run code in 300+ PHP versions simultaneously
<?php function string_inthash($str) { $a = (int)preg_replace('#[^0-9]#u', '', sha1($str)) * (int)date('YmdHis'); if (PHP_INT_MAX != 0x0000000080000000) { // 2147483647 $a = -(~($a & 0x00000000FFFFFFFF) + 1); } return (int)$a; } $str = 'secret'; echo string_inthash($str); /* $a = date('YmdHi'); $b = 'secret'; $bb = sha1($b); $bc = preg_replace('#[^0-9]#u', '', $bb); $bd = (int)$bc - (int)$a; $c = "{$b}|{$a}"; $d = base64_encode($c); $e = base64_decode($d); echo $a . PHP_EOL; echo $b . PHP_EOL; echo $bb . PHP_EOL; echo $bc . PHP_EOL; echo $bd . PHP_EOL; echo $c . PHP_EOL; echo $d . PHP_EOL; echo $e . PHP_EOL; */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TBMt8
function name:  (null)
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, 'secret'
   13     1        INIT_FCALL                                               'string_inthash'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   36     5      > RETURN                                                   1

Function string_inthash:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/TBMt8
function name:  string_inthash
number of ops:  25
compiled vars:  !0 = $str, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%23%5B%5E0-9%5D%23u'
          3        SEND_VAL                                                 ''
          4        INIT_FCALL                                               'sha1'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9        CAST                                          4  ~4      $3
         10        INIT_FCALL                                               'date'
         11        SEND_VAL                                                 'YmdHis'
         12        DO_ICALL                                         $5      
         13        CAST                                          4  ~6      $5
         14        MUL                                              ~7      ~4, ~6
         15        ASSIGN                                                   !1, ~7
    5    16      > JMPZ                                                     <true>, ->22
    6    17    >   BW_AND                                           ~9      !1, 4294967295
         18        BW_NOT                                           ~10     ~9
         19        ADD                                              ~11     ~10, 1
         20        MUL                                              ~12     ~11, -1
         21        ASSIGN                                                   !1, ~12
    8    22    >   CAST                                          4  ~14     !1
         23      > RETURN                                                   ~14
   10    24*     > RETURN                                                   null

End of function string_inthash

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.79 ms | 1399 KiB | 20 Q