3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ColumnKeyClass { function __toString() { return 'first_name'; } } class IndexKeyClass { function __toString() { return 'id'; } } $column_key = new ColumnKeyClass(); $index_key = new IndexKeyClass(); $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'XXX' ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith' )); var_dump($column_key); var_dump($index_key); $firstNames = array_column($records, $column_key, $index_key); print_r($firstNames); var_dump($column_key); var_dump($index_key);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQqh2
function name:  (null)
number of ops:  31
compiled vars:  !0 = $column_key, !1 = $index_key, !2 = $records, !3 = $firstNames
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'columnkeyclass'
    3     1        DECLARE_CLASS                                                'indexkeyclass'
    4     2        NEW                                                  $4      'ColumnKeyClass'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $4
    5     5        NEW                                                  $7      'IndexKeyClass'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $7
    7     8        ASSIGN                                                       !2, <array>
   19     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                                     
         12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAR                                                     !1
         14        DO_ICALL                                                     
   20    15        INIT_FCALL                                                   'array_column'
         16        SEND_VAR                                                     !2
         17        SEND_VAR                                                     !0
         18        SEND_VAR                                                     !1
         19        DO_ICALL                                             $13     
         20        ASSIGN                                                       !3, $13
   21    21        INIT_FCALL                                                   'print_r'
         22        SEND_VAR                                                     !3
         23        DO_ICALL                                                     
   22    24        INIT_FCALL                                                   'var_dump'
         25        SEND_VAR                                                     !0
         26        DO_ICALL                                                     
         27        INIT_FCALL                                                   'var_dump'
         28        SEND_VAR                                                     !1
         29        DO_ICALL                                                     
         30      > RETURN                                                       1

Class ColumnKeyClass:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQqh2
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E > > RETURN                                                       'first_name'
          1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __tostring

End of class ColumnKeyClass.

Class IndexKeyClass:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQqh2
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                       'id'
          1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __tostring

End of class IndexKeyClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.78 ms | 2821 KiB | 16 Q