3v4l.org

run code in 300+ PHP versions simultaneously
<?php //if (version_compare(PHP_VERSION, '5.2', '<')) { // exit 'no json_encode() support'; //} $array = array('text' => "<h1>Кириллический URL</h1>\n<p>This is Cyrillic URL example. Try <a class=js-as dir=rtl href=עברית>RTL עברית</a>.</p>\n"); if (version_compare(PHP_VERSION, '5.4', '>=')) { $data = json_encode($array, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } else { //$data = str_replace('\\/', '/', json_encode($array)); $data = preg_replace('/\\\\u([a-f0-9]{4})/e', "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", json_encode($array)); $data = preg_replace('\\/', '/', json_encode($array)); } echo $data;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mkrGB
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'version_compare'
          2        SEND_VAL                                                 '8.0.0'
          3        SEND_VAL                                                 '5.4'
          4        SEND_VAL                                                 '%3E%3D'
          5        DO_ICALL                                         $3      
          6      > JMPZ                                                     $3, ->13
   10     7    >   INIT_FCALL                                               'json_encode'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 320
         10        DO_ICALL                                         $4      
         11        ASSIGN                                                   !1, $4
         12      > JMP                                                      ->31
   13    13    >   INIT_FCALL                                               'preg_replace'
         14        SEND_VAL                                                 '%2F%5C%5Cu%28%5Ba-f0-9%5D%7B4%7D%29%2Fe'
         15        SEND_VAL                                                 'iconv%28%27UCS-4LE%27%2C%27UTF-8%27%2Cpack%28%27V%27%2C+hexdec%28%27U%241%27%29%29%29'
         16        INIT_FCALL                                               'json_encode'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $6      
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                         $7      
         21        ASSIGN                                                   !1, $7
   14    22        INIT_FCALL                                               'preg_replace'
         23        SEND_VAL                                                 '%5C%2F'
         24        SEND_VAL                                                 '%2F'
         25        INIT_FCALL                                               'json_encode'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $9      
         28        SEND_VAR                                                 $9
         29        DO_ICALL                                         $10     
         30        ASSIGN                                                   !1, $10
   17    31    >   ECHO                                                     !1
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.46 ms | 1388 KiB | 19 Q