3v4l.org

run code in 300+ 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:  37
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        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2F%5B%5Cx00-%5Cx1F%5Cx80-%5CxFF%5D%2F'
          7        SEND_VAL                                                 ''
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
    8    11        INIT_FCALL                                               'json_decode'
         12        INIT_FCALL                                               'preg_replace'
         13        SEND_VAL                                                 '%2F%5B%5Cx00-%5Cx1F%5Cx80-%5CxFF%5D%2F'
         14        SEND_VAL                                                 ''
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $6      
         17        SEND_VAR                                                 $6
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $7      
         20        SEND_VAR                                                 $7
    5    21        DO_ICALL                                                 
   11    22        INIT_FCALL                                               'preg_replace'
         23        SEND_VAL                                                 '%2F%5E%EF%BB%BF%2F'
         24        SEND_VAL                                                 ''
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $9      
         27        ASSIGN                                                   !1, $9
   12    28        INIT_FCALL                                               'var_dump'
   13    29        SEND_VAR                                                 !1
   14    30        INIT_FCALL                                               'json_decode'
         31        SEND_VAR                                                 !1
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $11     
         34        SEND_VAR                                                 $11
   12    35        DO_ICALL                                                 
   15    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.87 ms | 1003 KiB | 16 Q