3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = ARRAY(); $foo[0] = ARRAY('key'=>'key0', 'value'=>'value0', 'text'=>'text0', 'int'=>1000); $foo[1] = ARRAY('key'=>'key1', 'value'=>'value1', 'text'=>'text1', 'int'=>1001); $foo[2] = ARRAY('key'=>'key2', 'value'=>'value2', 'text'=>'text2', 'int'=>1002); $foo[3] = ARRAY('key'=>'key3', 'value'=>'value3', 'text'=>'text3', 'int'=>1003); $foo[5] = ARRAY('key'=>'key5', 'value'=>'value5', 'text'=>'text5', 'int'=>1005); $foo[7] = ARRAY('key'=>'key7', 'value'=>'value7', 'text'=>'text7', 'int'=>1007); $foo[7] = ARRAY('key'=>'key7', 'value'=>'value7', 'text'=>'text7', 'int'=>1008); // reset indexes, set column 'value' as values $result1 = ArrayColumn($foo, 'value'); var_export($result1); print "\n\n"; // re-index with column 'key', use column 'value' as values $result2 = ArrayColumn($foo, 'value', 'key'); var_export($result2); print "\n\n"; // re-index with column 'int', use column 'value' as values $result3 = ArrayColumn($foo, 'value', 'int'); var_export($result3); print "\n\n"; // re-index with column 'int', use COMPLETE ARRAY as values $result4 = ArrayColumn($foo, NULL, 'int'); var_export($result4); print "\n\n"; function ArrayColumn($arr=FALSE, $column_value=NULL, $column_index=NULL, $unique=FALSE) { $arr = array_column($arr, $column_value, $column_index); if ($unique === TRUE) { $arr = array_unique($arr); } return $arr; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8IuJ5
function name:  (null)
number of ops:  55
compiled vars:  !0 = $foo, !1 = $result1, !2 = $result2, !3 = $result3, !4 = $result4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  <array>
    6     3        ASSIGN_DIM                                               !0, 1
          4        OP_DATA                                                  <array>
    7     5        ASSIGN_DIM                                               !0, 2
          6        OP_DATA                                                  <array>
    8     7        ASSIGN_DIM                                               !0, 3
          8        OP_DATA                                                  <array>
    9     9        ASSIGN_DIM                                               !0, 5
         10        OP_DATA                                                  <array>
   10    11        ASSIGN_DIM                                               !0, 7
         12        OP_DATA                                                  <array>
   11    13        ASSIGN_DIM                                               !0, 7
         14        OP_DATA                                                  <array>
   14    15        INIT_FCALL_BY_NAME                                       'ArrayColumn'
         16        SEND_VAR_EX                                              !0
         17        SEND_VAL_EX                                              'value'
         18        DO_FCALL                                      0  $13     
         19        ASSIGN                                                   !1, $13
   15    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
         23        ECHO                                                     '%0A%0A'
   18    24        INIT_FCALL_BY_NAME                                       'ArrayColumn'
         25        SEND_VAR_EX                                              !0
         26        SEND_VAL_EX                                              'value'
         27        SEND_VAL_EX                                              'key'
         28        DO_FCALL                                      0  $16     
         29        ASSIGN                                                   !2, $16
   19    30        INIT_FCALL                                               'var_export'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                                 
         33        ECHO                                                     '%0A%0A'
   22    34        INIT_FCALL_BY_NAME                                       'ArrayColumn'
         35        SEND_VAR_EX                                              !0
         36        SEND_VAL_EX                                              'value'
         37        SEND_VAL_EX                                              'int'
         38        DO_FCALL                                      0  $19     
         39        ASSIGN                                                   !3, $19
   23    40        INIT_FCALL                                               'var_export'
         41        SEND_VAR                                                 !3
         42        DO_ICALL                                                 
         43        ECHO                                                     '%0A%0A'
   26    44        INIT_FCALL_BY_NAME                                       'ArrayColumn'
         45        SEND_VAR_EX                                              !0
         46        SEND_VAL_EX                                              null
         47        SEND_VAL_EX                                              'int'
         48        DO_FCALL                                      0  $22     
         49        ASSIGN                                                   !4, $22
   27    50        INIT_FCALL                                               'var_export'
         51        SEND_VAR                                                 !4
         52        DO_ICALL                                                 
         53        ECHO                                                     '%0A%0A'
   35    54      > RETURN                                                   1

Function arraycolumn:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/8IuJ5
function name:  ArrayColumn
number of ops:  18
compiled vars:  !0 = $arr, !1 = $column_value, !2 = $column_index, !3 = $unique
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV_INIT                                        !0      <false>
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
          3        RECV_INIT                                        !3      <false>
   31     4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
   32    10        TYPE_CHECK                                    8          !3
         11      > JMPZ                                                     ~6, ->16
         12    >   INIT_FCALL                                               'array_unique'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !0, $7
   33    16    > > RETURN                                                   !0
   34    17*     > RETURN                                                   null

End of function arraycolumn

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.27 ms | 1400 KiB | 19 Q