3v4l.org

run code in 300+ PHP versions simultaneously
<?php $objs = [ ['value'=>2, 'key'=>'a'], ['value'=>3, 'key'=>'b'] ]; print_r($objs); $keys = array_column($objs, 'key'); $index = array_search('a', $keys); if ($index !== false) { $objs[$index]['value'] = 5; } print_r($objs);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/QUjuY
function name:  (null)
number of ops:  23
compiled vars:  !0 = $objs, !1 = $keys, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'key'
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
    7     9        INIT_FCALL                                               'array_search'
         10        SEND_VAL                                                 'a'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !2, $7
    9    14        TYPE_CHECK                                  1018          !2
         15      > JMPZ                                                     ~9, ->19
   10    16    >   FETCH_DIM_W                                      $10     !0, !2
         17        ASSIGN_DIM                                               $10, 'value'
         18        OP_DATA                                                  5
   13    19    >   INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163 ms | 1447 KiB | 16 Q