3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"options": {"options0": {"name":"soph","value":"School of Public Health"}, "options1": {"name":"son","value":"School of Nursing"}, "options2": {"name":"sohp","value":"School of Health Professions"} } }'; $arr = array_column(json_decode($json, true)['options'], "value", "name"); var_dump($arr); echo $arr['sohp'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3MdIN
function name:  (null)
number of ops:  18
compiled vars:  !0 = $json, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22options%22%3A++%0A++++++++%7B%22options0%22%3A++%0A++++++++++++%7B%22name%22%3A%22soph%22%2C%22value%22%3A%22School+of+Public+Health%22%7D%2C++%0A++++++++%22options1%22%3A++%0A++++++++++++%7B%22name%22%3A%22son%22%2C%22value%22%3A%22School+of+Nursing%22%7D%2C++%0A++++++++%22options2%22%3A++%0A++++++++++++%7B%22name%22%3A%22sohp%22%2C%22value%22%3A%22School+of+Health+Professions%22%7D++%0A++++++++%7D%0A++++%7D'
   13     1        INIT_FCALL                                               'array_column'
          2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        FETCH_DIM_R                                      ~4      $3, 'options'
          7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 'value'
          9        SEND_VAL                                                 'name'
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !1, $5
   14    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   16    15        FETCH_DIM_R                                      ~8      !1, 'sohp'
         16        ECHO                                                     ~8
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.88 ms | 1012 KiB | 16 Q