3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fp = fopen('php://stdin', 'r'); $json = @json_encode(array('a' => 'foo', 'b' => $fp)); var_dump($json, json_last_error_msg());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QohfG
function name:  (null)
number of ops:  20
compiled vars:  !0 = $fp, !1 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'php%3A%2F%2Fstdin'
          2        SEND_VAL                                                 'r'
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    3     5        BEGIN_SILENCE                                    ~4      
          6        INIT_FCALL                                               'json_encode'
          7        INIT_ARRAY                                       ~5      'foo', 'a'
          8        ADD_ARRAY_ELEMENT                                ~5      !0, 'b'
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                         $6      
         11        END_SILENCE                                              ~4
         12        ASSIGN                                                   !1, $6
    4    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        INIT_FCALL                                               'json_last_error_msg'
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.05 ms | 1395 KiB | 21 Q