3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'a' =>'hello' ); $arr = 2; $json_arr = json_encode($arr); $payload = ((object)json_decode($json_arr))[0]; //$payload = array_values(((array)json_decode($json_arr)))[0]; //$payload = json_decode($json_arr); //$payload = reset((array)json_decode($json_arr)); print_r($payload);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K01R2
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arr, !1 = $json_arr, !2 = $payload
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !0, 2
    8     2        INIT_FCALL                                               'json_encode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   10     6        INIT_FCALL                                               'json_decode'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        CAST                                          8  ~8      $7
         10        FETCH_DIM_R                                      ~9      ~8, 0
         11        ASSIGN                                                   !2, ~9
   15    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.62 ms | 1385 KiB | 19 Q