3v4l.org

run code in 500+ PHP versions simultaneously
<?php $bom = "\xef\xbb\xbf"; $json_string = $bom.'{"greeting":"Tschüss welt","emoji":"😃"}'; var_dump( $json_string, preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $json_string), json_decode(preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $json_string), true) ); // removing the BOM sequence only and from the very beginning only $json_string = preg_replace("/^\xEF\xBB\xBF/", '', $json_string); var_dump( $json_string, json_decode($json_string, true) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a1l3s
function name:  (null)
number of ops:  28
compiled vars:  !0 = $bom, !1 = $json_string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%EF%BB%BF'
    3     1        CONCAT                                               ~3      !0, '%7B%22greeting%22%3A%22Tsch%C3%BCss+welt%22%2C%22emoji%22%3A%22%F0%9F%98%83%22%7D'
          2        ASSIGN                                                       !1, ~3
    5     3        INIT_FCALL                                                   'var_dump'
    6     4        SEND_VAR                                                     !1
    7     5        FRAMELESS_ICALL_3                preg_replace        ~5      '%2F%5B%5Cx00-%5Cx1F%5Cx80-%5CxFF%5D%2F', ''
          6        OP_DATA                                                      !1
          7        SEND_VAL                                                     ~5
    8     8        INIT_FCALL                                                   'json_decode'
          9        FRAMELESS_ICALL_3                preg_replace        ~6      '%2F%5B%5Cx00-%5Cx1F%5Cx80-%5CxFF%5D%2F', ''
         10        OP_DATA                                                      !1
         11        SEND_VAL                                                     ~6
         12        SEND_VAL                                                     <true>
         13        DO_ICALL                                             $7      
         14        SEND_VAR                                                     $7
    5    15        DO_ICALL                                                     
   11    16        FRAMELESS_ICALL_3                preg_replace        ~9      '%2F%5E%EF%BB%BF%2F', ''
         17        OP_DATA                                                      !1
         18        ASSIGN                                                       !1, ~9
   12    19        INIT_FCALL                                                   'var_dump'
   13    20        SEND_VAR                                                     !1
   14    21        INIT_FCALL                                                   'json_decode'
         22        SEND_VAR                                                     !1
         23        SEND_VAL                                                     <true>
         24        DO_ICALL                                             $11     
         25        SEND_VAR                                                     $11
   12    26        DO_ICALL                                                     
   15    27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.39 ms | 1516 KiB | 15 Q