3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $json = array( "Sample" => array( "context" => 'جمهوری ناسلامی ایران', "test" => '\u1234', ) ); $encoded = json_encode($json); var_dump($encoded); $unescaped = preg_replace_callback('/(?<!\\\\)\\\\u(\w{4})/', function ($matches) { return html_entity_decode('&#x' . $matches[1] . ';', ENT_COMPAT, 'UTF-8'); }, $encoded); var_dump($unescaped);
based on XslFJ
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/9csm6
function name:  (null)
number of ops:  19
compiled vars:  !0 = $json, !1 = $encoded, !2 = $unescaped
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E >   ASSIGN                                                   !0, <array>
  10     1        INIT_FCALL                                               'json_encode'
         2        SEND_VAR                                                 !0
         3        DO_ICALL                                         $4      
         4        ASSIGN                                                   !1, $4
  11     5        INIT_FCALL                                               'var_dump'
         6        SEND_VAR                                                 !1
         7        DO_ICALL                                                 
  13     8        INIT_FCALL                                               'preg_replace_callback'
         9        SEND_VAL                                                 '%2F%28%3F%3C%21%5C%5C%29%5C%5Cu%28%5Cw%7B4%7D%29%2F'
        10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9csm60x7fb1f4193169'
  15    11        SEND_VAL                                                 ~7
        12        SEND_VAR                                                 !1
        13        DO_ICALL                                         $8      
        14        ASSIGN                                                   !2, $8
  16    15        INIT_FCALL                                               'var_dump'
        16        SEND_VAR                                                 !2
        17        DO_ICALL                                                 
        18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9csm60x7fb1f4193169:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/9csm6
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $matches
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   RECV                                             !0      
  14     1        INIT_FCALL                                               'html_entity_decode'
         2        FETCH_DIM_R                                      $1      !0, 1
         3        CONCAT                                           ~2      '%26%23x', $1
         4        CONCAT                                           ~3      ~2, '%3B'
         5        SEND_VAL                                                 ~3
         6        SEND_VAL                                                 2
         7        SEND_VAL                                                 'UTF-8'
         8        DO_ICALL                                         $4      
         9      > RETURN                                                   $4
  15    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9csm60x7fb1f4193169

Generated using Vulcan Logic Dumper, using php 7.1.0