3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = json_encode(['end' => json_decode(null, true)]); var_dump($result); class A implements \JsonSerializable { function jsonSerialize() { return ['end' => json_decode(null, true)]; } } $a = new A(); $toJsonData = $a->jsonSerialize(); $result = json_encode($a); var_dump($result); $result = json_encode($toJsonData); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UraSC
function name:  (null)
number of ops:  34
compiled vars:  !0 = $result, !1 = $a, !2 = $toJsonData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_encode'
          1        INIT_FCALL                                               'json_decode'
          2        SEND_VAL                                                 null
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $3      
          5        INIT_ARRAY                                       ~4      $3, 'end'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !0, $5
    4     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
    6    12        DECLARE_CLASS                                            'a'
   13    13        NEW                                              $8      'A'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $8
   14    16        INIT_METHOD_CALL                                         !1, 'jsonSerialize'
         17        DO_FCALL                                      0  $11     
         18        ASSIGN                                                   !2, $11
   15    19        INIT_FCALL                                               'json_encode'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $13     
         22        ASSIGN                                                   !0, $13
   16    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   18    26        INIT_FCALL                                               'json_encode'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $16     
         29        ASSIGN                                                   !0, $16
   19    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Class A:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UraSC
function name:  jsonSerialize
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 null
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $0      
          4        INIT_ARRAY                                       ~1      $0, 'end'
          5      > RETURN                                                   ~1
   11     6*     > RETURN                                                   null

End of function jsonserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
203.79 ms | 1400 KiB | 19 Q