3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON [ { "foo": "bar", "subject": "some subject" }, { "qux": "baz", "subject": "some other subject" } ] JSON; $data = json_decode($json, true); // true is important otherwise will get a stdObject - not an array $subjects = array(); foreach ($data as $a) { $subjects[] = $a['subject']; } var_dump($subjects);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/AIr3N
function name:  (null)
number of ops:  18
compiled vars:  !0 = $json, !1 = $data, !2 = $subjects, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%0A%09%7B%0A%09%09%22foo%22%3A+%22bar%22%2C%0A%09%09%22subject%22%3A+%22some+subject%22%0A%09%7D%2C%0A%09%7B%0A%09%09%22qux%22%3A+%22baz%22%2C%0A%09%09%22subject%22%3A+%22some+other+subject%22%0A%09%7D%0A%5D'
   16     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   17     6        ASSIGN                                                   !2, <array>
   18     7      > FE_RESET_R                                       $8      !1, ->13
          8    > > FE_FETCH_R                                               $8, !3, ->13
   19     9    >   FETCH_DIM_R                                      ~10     !3, 'subject'
         10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  ~10
   18    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $8
   22    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.2 ms | 1395 KiB | 17 Q