3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ps = ["fo\"obar", "foobar\"", "foobar\\\\\"", "foo\\\"\"bar"]; foreach ($ps as $p) { $c = json_encode(["foo"=>["password"=>$p]]); echo preg_replace('{("password"\s*:\s*)"(?:[^"\\\\]|(?:\\\\.))*"}', '$1"****"', $c), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/225su
function name:  (null)
number of ops:  19
compiled vars:  !0 = $ps, !1 = $p, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $4      !0, ->17
          2    > > FE_FETCH_R                                               $4, !1, ->17
    5     3    >   INIT_FCALL                                               'json_encode'
          4        INIT_ARRAY                                       ~5      !1, 'password'
          5        INIT_ARRAY                                       ~6      ~5, 'foo'
          6        SEND_VAL                                                 ~6
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !2, $7
    6     9        INIT_FCALL                                               'preg_replace'
         10        SEND_VAL                                                 '%7B%28%22password%22%5Cs%2A%3A%5Cs%2A%29%22%28%3F%3A%5B%5E%22%5C%5C%5D%7C%28%3F%3A%5C%5C.%29%29%2A%22%7D'
         11        SEND_VAL                                                 '%241%22%2A%2A%2A%2A%22'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $9      
         14        ECHO                                                     $9
         15        ECHO                                                     '%0A'
    4    16      > JMP                                                      ->2
         17    >   FE_FREE                                                  $4
    7    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.87 ms | 1395 KiB | 17 Q