3v4l.org

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

Function isjson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KgV8W
function name:  isJson
number of ops:  9
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4        INIT_FCALL                                               'json_last_error'
          5        DO_ICALL                                         $2      
          6        IS_EQUAL                                         ~3      $2, 0
          7      > RETURN                                                   ~3
    8     8*     > RETURN                                                   null

End of function isjson

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.42 ms | 1397 KiB | 22 Q