3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Examples 1 & 2 from http://nl3.php.net/array_column $records = array( 4 => array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), 8 => array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), 2 => array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones', ), '00013411' => array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); // Example 1: original indexes are lost =( print_r(array_column($records, 'first_name')); // Example 2: new indexes are 'id' column print_r(array_column($records, 'last_name', 'id')); // Example 3: full objects by 'last_name' print_r(array_column($records, null, 'last_name')); // Example 4: no pick and no index print_r(array_column($records, null)); // Example 5: objects instead of arrays? $objects = array_map(function($arr) { return (object)$arr; }, $records); print_r($objects); print_r(array_column($records, 'last_name', 'id'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQPK7
function name:  (null)
number of ops:  49
compiled vars:  !0 = $records, !1 = $objects
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   29     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'first_name'
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   32     8        INIT_FCALL                                               'print_r'
          9        INIT_FCALL                                               'array_column'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'last_name'
         12        SEND_VAL                                                 'id'
         13        DO_ICALL                                         $5      
         14        SEND_VAR                                                 $5
         15        DO_ICALL                                                 
   35    16        INIT_FCALL                                               'print_r'
         17        INIT_FCALL                                               'array_column'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 null
         20        SEND_VAL                                                 'last_name'
         21        DO_ICALL                                         $7      
         22        SEND_VAR                                                 $7
         23        DO_ICALL                                                 
   38    24        INIT_FCALL                                               'print_r'
         25        INIT_FCALL                                               'array_column'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 null
         28        DO_ICALL                                         $9      
         29        SEND_VAR                                                 $9
         30        DO_ICALL                                                 
   41    31        INIT_FCALL                                               'array_map'
         32        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGQPK7%3A41%240'
         33        SEND_VAL                                                 ~11
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $12     
         36        ASSIGN                                                   !1, $12
   42    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
   43    40        INIT_FCALL                                               'print_r'
         41        INIT_FCALL                                               'array_column'
         42        SEND_VAR                                                 !0
         43        SEND_VAL                                                 'last_name'
         44        SEND_VAL                                                 'id'
         45        DO_ICALL                                         $15     
         46        SEND_VAR                                                 $15
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FGQPK7%3A41%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQPK7
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        CAST                                          8  ~1      !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGQPK7%3A41%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.44 ms | 1400 KiB | 19 Q