3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST = ['test'=>'some "test" stuff']; echo $json = json_encode($_POST).PHP_EOL; //sent to DB after bindprepare escapes it echo addslashes($json).PHP_EOL; //stored in DB as slashes above are not stored echo $json.PHP_EOL; //efter retrieving from DB and decode print_r(json_decode($json, true)).PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g6gEN
function name:  (null)
number of ops:  26
compiled vars:  !0 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_W                      global              $1      '_POST'
          1        ASSIGN                                                   $1, <array>
    4     2        INIT_FCALL                                               'json_encode'
          3        FETCH_R                      global              ~3      '_POST'
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
          6        CONCAT                                           ~5      $4, '%0A'
          7        ASSIGN                                           ~6      !0, ~5
          8        ECHO                                                     ~6
    7     9        INIT_FCALL                                               'addslashes'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        CONCAT                                           ~8      $7, '%0A'
         13        ECHO                                                     ~8
    9    14        CONCAT                                           ~9      !0, '%0A'
         15        ECHO                                                     ~9
   11    16        INIT_FCALL                                               'print_r'
         17        INIT_FCALL                                               'json_decode'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $10     
         21        SEND_VAR                                                 $10
         22        DO_ICALL                                         $11     
         23        CONCAT                                           ~12     $11, '%0A'
         24        FREE                                                     ~12
   12    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.31 ms | 1000 KiB | 17 Q