3v4l.org

run code in 500+ PHP versions simultaneously
<?php function base64_encode_url($string) { return str_replace(['+','/','='], ['-','_',''], base64_encode($string)); } function base64_decode_url($string) { return base64_decode(str_replace(['-','_'], ['+','/'], $string)); } for ($i=0; $i<20000; $i++) { $data = random_bytes(rand(12,20)); if (base64_decode_url(base64_encode($data)) !== $data) { echo "FAIL"; } } echo "OK";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 2
Branch analysis from position: 22
Branch analysis from position: 2
Branch analysis from position: 19
filename:       /in/aEs4o
function name:  (null)
number of ops:  24
compiled vars:  !0 = $i, !1 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->20
   12     2    >   INIT_FCALL                                                   'random_bytes'
          3        INIT_FCALL                                                   'rand'
          4        SEND_VAL                                                     12
          5        SEND_VAL                                                     20
          6        DO_ICALL                                             $3      
          7        SEND_VAR                                                     $3
          8        DO_ICALL                                             $4      
          9        ASSIGN                                                       !1, $4
   13    10        INIT_FCALL                                                   'base64_decode_url'
         11        INIT_FCALL                                                   'base64_encode'
         12        SEND_VAR                                                     !1
         13        DO_ICALL                                             $6      
         14        SEND_VAR                                                     $6
         15        DO_FCALL                                          0  $7      
         16        IS_NOT_IDENTICAL                                             !1, $7
         17      > JMPZ                                                         ~8, ->19
   14    18    >   ECHO                                                         'FAIL'
   11    19    >   PRE_INC                                                      !0
         20    >   IS_SMALLER                                                   !0, 20000
         21      > JMPNZ                                                        ~10, ->2
   18    22    >   ECHO                                                         'OK'
         23      > RETURN                                                       1

Function base64_encode_url:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aEs4o
function name:  base64_encode_url
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'base64_encode'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FRAMELESS_ICALL_3                str_replace         ~2      <array>, <array>
          5        OP_DATA                                                      $1
          6      > RETURN                                                       ~2
    5     7*     > RETURN                                                       null

End of function base64_encode_url

Function base64_decode_url:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aEs4o
function name:  base64_decode_url
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        INIT_FCALL                                                   'base64_decode'
          2        FRAMELESS_ICALL_3                str_replace         ~1      <array>, <array>
          3        OP_DATA                                                      !0
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                             $2      
          6      > RETURN                                                       $2
    9     7*     > RETURN                                                       null

End of function base64_decode_url

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
186.61 ms | 2594 KiB | 20 Q