3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isJson($string, $assoc = false) { var_dump(json_decode($string)); if(is_string($string)) { json_decode($string); return (json_last_error() == JSON_ERROR_NONE); // return json_decode($str) != null; } return false; } $a=['arraiii'=>['dentro'=>234]]; $b=json_encode($a); $c='{hg}'; var_dump(isJson($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JS0Zu
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'json_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   22     5        ASSIGN                                                   !2, '%7Bhg%7D'
   24     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'isjson'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function isjson:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JS0Zu
function name:  isJson
number of ops:  19
compiled vars:  !0 = $string, !1 = $assoc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    8     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'json_decode'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   10     8        TYPE_CHECK                                   64          !0
          9      > JMPZ                                                     ~4, ->17
   11    10    >   INIT_FCALL                                               'json_decode'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   12    13        INIT_FCALL                                               'json_last_error'
         14        DO_ICALL                                         $6      
         15        IS_EQUAL                                         ~7      $6, 0
         16      > RETURN                                                   ~7
   15    17    > > RETURN                                                   <false>
   16    18*     > RETURN                                                   null

End of function isjson

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.38 ms | 1398 KiB | 22 Q