3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ null, false, 1, 1.5, 'string', ['string in array without keys'], ['key' => 'string in array with keys'], [ 'multi-dim array' => 'string', 'sub-array' => [ 1, 2, 3] ], ]; foreach($test as $l10n) { echo PHP_EOL,'=======================', PHP_EOL; echo PHP_EOL,'Input',PHP_EOL; var_dump($l10n); $copy = $l10n; foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } $encoded1 = json_encode( $l10n ); echo PHP_EOL,'Original output',PHP_EOL; var_dump($encoded1); $l10n = $copy; if ( is_string( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { $l10n = (array) $l10n; foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded2 = json_encode( $l10n ); echo PHP_EOL,'Patch Peter output',PHP_EOL; var_dump($encoded2); if ($encoded1 !== $encoded2) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded3 = json_encode( $l10n ); echo PHP_EOL,'Patch Sergey output',PHP_EOL; var_dump($encoded3); if ($encoded1 !== $encoded3) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { // Throw the _doing_it_wrong_warning. $l10n = (array) $l10n; } foreach ( $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } $encoded4 = json_encode( $l10n ); echo PHP_EOL,'Patch 1 Juliette output',PHP_EOL; var_dump($encoded4); if ($encoded1 !== $encoded4) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } $l10n = $copy; if ( ! is_array( $l10n ) ) { // Throw the _doing_it_wrong_warning. } if ( is_string( $l10n ) ) { $l10n = html_entity_decode( (string) $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $encoded5 = json_encode( $l10n ); echo PHP_EOL,'Patch 2 Juliette output',PHP_EOL; var_dump($encoded5); if ($encoded1 !== $encoded5) { echo "*** BC-break detected in patch!! ***", PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 212
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 212
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 52
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 85
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 97
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
2 jumps found. (Code = 43) Position 1 = 126, Position 2 = 128
Branch analysis from position: 126
2 jumps found. (Code = 43) Position 1 = 132, Position 2 = 134
Branch analysis from position: 132
2 jumps found. (Code = 77) Position 1 = 135, Position 2 = 150
Branch analysis from position: 135
2 jumps found. (Code = 78) Position 1 = 136, Position 2 = 150
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 140, Position 2 = 141
Branch analysis from position: 140
1 jumps found. (Code = 42) Position 1 = 135
Branch analysis from position: 135
Branch analysis from position: 141
1 jumps found. (Code = 42) Position 1 = 135
Branch analysis from position: 135
Branch analysis from position: 150
2 jumps found. (Code = 43) Position 1 = 163, Position 2 = 165
Branch analysis from position: 163
2 jumps found. (Code = 43) Position 1 = 169, Position 2 = 169
Branch analysis from position: 169
2 jumps found. (Code = 43) Position 1 = 171, Position 2 = 179
Branch analysis from position: 171
1 jumps found. (Code = 42) Position 1 = 197
Branch analysis from position: 197
2 jumps found. (Code = 43) Position 1 = 209, Position 2 = 211
Branch analysis from position: 209
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 211
Branch analysis from position: 179
2 jumps found. (Code = 77) Position 1 = 181, Position 2 = 196
Branch analysis from position: 181
2 jumps found. (Code = 78) Position 1 = 182, Position 2 = 196
Branch analysis from position: 182
2 jumps found. (Code = 43) Position 1 = 186, Position 2 = 187
Branch analysis from position: 186
1 jumps found. (Code = 42) Position 1 = 181
Branch analysis from position: 181
Branch analysis from position: 187
1 jumps found. (Code = 42) Position 1 = 181
Branch analysis from position: 181
Branch analysis from position: 196
2 jumps found. (Code = 43) Position 1 = 209, Position 2 = 211
Branch analysis from position: 209
Branch analysis from position: 211
Branch analysis from position: 196
Branch analysis from position: 169
Branch analysis from position: 165
Branch analysis from position: 150
Branch analysis from position: 134
Branch analysis from position: 128
Branch analysis from position: 97
2 jumps found. (Code = 77) Position 1 = 98, Position 2 = 113
Branch analysis from position: 98
2 jumps found. (Code = 78) Position 1 = 99, Position 2 = 113
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 103, Position 2 = 104
Branch analysis from position: 103
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
Branch analysis from position: 104
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
Branch analysis from position: 113
2 jumps found. (Code = 43) Position 1 = 126, Position 2 = 128
Branch analysis from position: 126
Branch analysis from position: 128
Branch analysis from position: 113
Branch analysis from position: 85
Branch analysis from position: 52
2 jumps found. (Code = 77) Position 1 = 55, Position 2 = 70
Branch analysis from position: 55
2 jumps found. (Code = 78) Position 1 = 56, Position 2 = 70
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 61
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 85
Branch analysis from position: 83
Branch analysis from position: 85
Branch analysis from position: 70
Branch analysis from position: 30
Branch analysis from position: 212
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 212
filename:       /in/ODNk5
function name:  (null)
number of ops:  214
compiled vars:  !0 = $test, !1 = $l10n, !2 = $copy, !3 = $value, !4 = $key, !5 = $encoded1, !6 = $encoded2, !7 = $encoded3, !8 = $encoded4, !9 = $encoded5
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   16     1      > FE_RESET_R                                       $11     !0, ->212
          2    > > FE_FETCH_R                                               $11, !1, ->212
   17     3    >   ECHO                                                     '%0A'
          4        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D'
          5        ECHO                                                     '%0A'
   18     6        ECHO                                                     '%0A'
          7        ECHO                                                     'Input'
          8        ECHO                                                     '%0A'
   19     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   21    12        ASSIGN                                                   !2, !1
   23    13        CAST                                          7  ~14     !1
         14      > FE_RESET_R                                       $15     ~14, ->30
         15    > > FE_FETCH_R                                       ~16     $15, !3, ->30
         16    >   ASSIGN                                                   !4, ~16
   24    17        TYPE_CHECK                                  124  ~18     !3
         18        BOOL_NOT                                         ~19     ~18
         19      > JMPZ                                                     ~19, ->21
   25    20    > > JMP                                                      ->15
   28    21    >   INIT_FCALL                                               'html_entity_decode'
         22        CAST                                          6  ~21     !3
         23        SEND_VAL                                                 ~21
         24        SEND_VAL                                                 3
         25        SEND_VAL                                                 'UTF-8'
         26        DO_ICALL                                         $22     
         27        ASSIGN_DIM                                               !1, !4
         28        OP_DATA                                                  $22
   23    29      > JMP                                                      ->15
         30    >   FE_FREE                                                  $15
   31    31        INIT_FCALL                                               'json_encode'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                         $23     
         34        ASSIGN                                                   !5, $23
   33    35        ECHO                                                     '%0A'
         36        ECHO                                                     'Original+output'
         37        ECHO                                                     '%0A'
   34    38        INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !5
         40        DO_ICALL                                                 
   36    41        ASSIGN                                                   !1, !2
   38    42        TYPE_CHECK                                   64          !1
         43      > JMPZ                                                     ~27, ->52
   39    44    >   INIT_FCALL                                               'html_entity_decode'
         45        CAST                                          6  ~28     !1
         46        SEND_VAL                                                 ~28
         47        SEND_VAL                                                 3
         48        SEND_VAL                                                 'UTF-8'
         49        DO_ICALL                                         $29     
         50        ASSIGN                                                   !1, $29
         51      > JMP                                                      ->71
   41    52    >   CAST                                          7  ~31     !1
         53        ASSIGN                                                   !1, ~31
   42    54      > FE_RESET_R                                       $33     !1, ->70
         55    > > FE_FETCH_R                                       ~34     $33, !3, ->70
         56    >   ASSIGN                                                   !4, ~34
   43    57        TYPE_CHECK                                  124  ~36     !3
         58        BOOL_NOT                                         ~37     ~36
         59      > JMPZ                                                     ~37, ->61
   44    60    > > JMP                                                      ->55
   47    61    >   INIT_FCALL                                               'html_entity_decode'
         62        CAST                                          6  ~39     !3
         63        SEND_VAL                                                 ~39
         64        SEND_VAL                                                 3
         65        SEND_VAL                                                 'UTF-8'
         66        DO_ICALL                                         $40     
         67        ASSIGN_DIM                                               !1, !4
         68        OP_DATA                                                  $40
   42    69      > JMP                                                      ->55
         70    >   FE_FREE                                                  $33
   51    71    >   INIT_FCALL                                               'json_encode'
         72        SEND_VAR                                                 !1
         73        DO_ICALL                                         $41     
         74        ASSIGN                                                   !6, $41
   53    75        ECHO                                                     '%0A'
         76        ECHO                                                     'Patch+Peter+output'
         77        ECHO                                                     '%0A'
   54    78        INIT_FCALL                                               'var_dump'
         79        SEND_VAR                                                 !6
         80        DO_ICALL                                                 
   56    81        IS_NOT_IDENTICAL                                         !5, !6
         82      > JMPZ                                                     ~44, ->85
   57    83    >   ECHO                                                     '%2A%2A%2A+BC-break+detected+in+patch%21%21+%2A%2A%2A'
         84        ECHO                                                     '%0A'
   60    85    >   ASSIGN                                                   !1, !2
   62    86        TYPE_CHECK                                  128  ~46     !1
         87        BOOL_NOT                                         ~47     ~46
         88      > JMPZ                                                     ~47, ->97
   63    89    >   INIT_FCALL                                               'html_entity_decode'
         90        CAST                                          6  ~48     !1
         91        SEND_VAL                                                 ~48
         92        SEND_VAL                                                 3
         93        SEND_VAL                                                 'UTF-8'
         94        DO_ICALL                                         $49     
         95        ASSIGN                                                   !1, $49
         96      > JMP                                                      ->114
   65    97    > > FE_RESET_R                                       $51     !1, ->113
         98    > > FE_FETCH_R                                       ~52     $51, !3, ->113
         99    >   ASSIGN                                                   !4, ~52
   66   100        TYPE_CHECK                                  124  ~54     !3
        101        BOOL_NOT                                         ~55     ~54
        102      > JMPZ                                                     ~55, ->104
   67   103    > > JMP                                                      ->98
   70   104    >   INIT_FCALL                                               'html_entity_decode'
        105        CAST                                          6  ~57     !3
        106        SEND_VAL                                                 ~57
        107        SEND_VAL                                                 3
        108        SEND_VAL                                                 'UTF-8'
        109        DO_ICALL                                         $58     
        110        ASSIGN_DIM                                               !1, !4
        111        OP_DATA                                                  $58
   65   112      > JMP                                                      ->98
        113    >   FE_FREE                                                  $51
   74   114    >   INIT_FCALL                                               'json_encode'
        115        SEND_VAR                                                 !1
        116        DO_ICALL                                         $59     
        117        ASSIGN                                                   !7, $59
   76   118        ECHO                                                     '%0A'
        119        ECHO                                                     'Patch+Sergey+output'
        120        ECHO                                                     '%0A'
   77   121        INIT_FCALL                                               'var_dump'
        122        SEND_VAR                                                 !7
        123        DO_ICALL                                                 
   79   124        IS_NOT_IDENTICAL                                         !5, !7
        125      > JMPZ                                                     ~62, ->128
   80   126    >   ECHO                                                     '%2A%2A%2A+BC-break+detected+in+patch%21%21+%2A%2A%2A'
        127        ECHO                                                     '%0A'
   83   128    >   ASSIGN                                                   !1, !2
   85   129        TYPE_CHECK                                  128  ~64     !1
        130        BOOL_NOT                                         ~65     ~64
        131      > JMPZ                                                     ~65, ->134
   87   132    >   CAST                                          7  ~66     !1
        133        ASSIGN                                                   !1, ~66
   90   134    > > FE_RESET_R                                       $68     !1, ->150
        135    > > FE_FETCH_R                                       ~69     $68, !3, ->150
        136    >   ASSIGN                                                   !4, ~69
   91   137        TYPE_CHECK                                  124  ~71     !3
        138        BOOL_NOT                                         ~72     ~71
        139      > JMPZ                                                     ~72, ->141
   92   140    > > JMP                                                      ->135
   95   141    >   INIT_FCALL                                               'html_entity_decode'
        142        CAST                                          6  ~74     !3
        143        SEND_VAL                                                 ~74
        144        SEND_VAL                                                 3
        145        SEND_VAL                                                 'UTF-8'
        146        DO_ICALL                                         $75     
        147        ASSIGN_DIM                                               !1, !4
        148        OP_DATA                                                  $75
   90   149      > JMP                                                      ->135
        150    >   FE_FREE                                                  $68
   98   151        INIT_FCALL                                               'json_encode'
        152        SEND_VAR                                                 !1
        153        DO_ICALL                                         $76     
        154        ASSIGN                                                   !8, $76
  100   155        ECHO                                                     '%0A'
        156        ECHO                                                     'Patch+1+Juliette+output'
        157        ECHO                                                     '%0A'
  101   158        INIT_FCALL                                               'var_dump'
        159        SEND_VAR                                                 !8
        160        DO_ICALL                                                 
  103   161        IS_NOT_IDENTICAL                                         !5, !8
        162      > JMPZ                                                     ~79, ->165
  104   163    >   ECHO                                                     '%2A%2A%2A+BC-break+detected+in+patch%21%21+%2A%2A%2A'
        164        ECHO                                                     '%0A'
  107   165    >   ASSIGN                                                   !1, !2
  109   166        TYPE_CHECK                                  128  ~81     !1
        167        BOOL_NOT                                         ~82     ~81
        168      > JMPZ                                                     ~82, ->169
  114   169    >   TYPE_CHECK                                   64          !1
        170      > JMPZ                                                     ~83, ->179
  115   171    >   INIT_FCALL                                               'html_entity_decode'
        172        CAST                                          6  ~84     !1
        173        SEND_VAL                                                 ~84
        174        SEND_VAL                                                 3
        175        SEND_VAL                                                 'UTF-8'
        176        DO_ICALL                                         $85     
        177        ASSIGN                                                   !1, $85
        178      > JMP                                                      ->197
  117   179    >   CAST                                          7  ~87     !1
        180      > FE_RESET_R                                       $88     ~87, ->196
        181    > > FE_FETCH_R                                       ~89     $88, !3, ->196
        182    >   ASSIGN                                                   !4, ~89
  118   183        TYPE_CHECK                                  124  ~91     !3
        184        BOOL_NOT                                         ~92     ~91
        185      > JMPZ                                                     ~92, ->187
  119   186    > > JMP                                                      ->181
  122   187    >   INIT_FCALL                                               'html_entity_decode'
        188        CAST                                          6  ~94     !3
        189        SEND_VAL                                                 ~94
        190        SEND_VAL                                                 3
        191        SEND_VAL                                                 'UTF-8'
        192        DO_ICALL                                         $95     
        193        ASSIGN_DIM                                               !1, !4
        194        OP_DATA                                                  $95
  117   195      > JMP                                                      ->181
        196    >   FE_FREE                                                  $88
  126   197    >   INIT_FCALL                                               'json_encode'
        198        SEND_VAR                                                 !1
        199        DO_ICALL                                         $96     
        200        ASSIGN                                                   !9, $96
  128   201        ECHO                                                     '%0A'
        202        ECHO                                                     'Patch+2+Juliette+output'
        203        ECHO                                                     '%0A'
  129   204        INIT_FCALL                                               'var_dump'
        205        SEND_VAR                                                 !9
        206        DO_ICALL                                                 
  131   207        IS_NOT_IDENTICAL                                         !5, !9
        208      > JMPZ                                                     ~99, ->211
  132   209    >   ECHO                                                     '%2A%2A%2A+BC-break+detected+in+patch%21%21+%2A%2A%2A'
        210        ECHO                                                     '%0A'
   16   211    > > JMP                                                      ->2
        212    >   FE_FREE                                                  $11
  134   213      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.7 ms | 1416 KiB | 19 Q