3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (! function_exists('array_column')) { function array_column($array, $column_key, $idx=NULL) { $result = array(); foreach ($array as $i => $item) { $result[$idx ? $item[$idx]: $i] = $item[$column_key]; } return $result; } } echo implode(', ', array_column(array(range(0, 4), range(0, 6), range(0, 5)), 2)), "\n"; class Artist implements ArrayAccess { public $artist_name; function __construct($name) { $this->artist_name = $name; } function offsetGet($name) { return $this->$name; } function offsetExists($name) { return isset($this->$name); } function offsetSet($name, $value) { $this->$name = $value; } function offsetUnset($name) { unset($this->$name); } } $artists = array( new Artist('Dali'), new Artist('Picasso'), new Artist('Titian'), ); var_dump(array_column($artists, 'artist_name')); /*****/
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/Ua1SU
function name:  (null)
number of ops:  53
compiled vars:  !0 = $artists
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'array_column'
          2        DO_ICALL                                         $1      
          3        BOOL_NOT                                         ~2      $1
          4      > JMPZ                                                     ~2, ->6
    3     5    >   DECLARE_FUNCTION                                         'array_column'
   12     6    >   INIT_FCALL                                               'implode'
          7        SEND_VAL                                                 '%2C+'
          8        INIT_FCALL                                               'array_column'
          9        INIT_FCALL                                               'range'
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 4
         12        DO_ICALL                                         $3      
         13        INIT_ARRAY                                       ~4      $3
         14        INIT_FCALL                                               'range'
         15        SEND_VAL                                                 0
         16        SEND_VAL                                                 6
         17        DO_ICALL                                         $5      
         18        ADD_ARRAY_ELEMENT                                ~4      $5
         19        INIT_FCALL                                               'range'
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 5
         22        DO_ICALL                                         $6      
         23        ADD_ARRAY_ELEMENT                                ~4      $6
         24        SEND_VAL                                                 ~4
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $7      
         27        SEND_VAR                                                 $7
         28        DO_ICALL                                         $8      
         29        ECHO                                                     $8
         30        ECHO                                                     '%0A'
   14    31        DECLARE_CLASS                                            'artist'
   34    32        NEW                                              $9      'Artist'
         33        SEND_VAL_EX                                              'Dali'
         34        DO_FCALL                                      0          
         35        INIT_ARRAY                                       ~11     $9
   35    36        NEW                                              $12     'Artist'
         37        SEND_VAL_EX                                              'Picasso'
         38        DO_FCALL                                      0          
         39        ADD_ARRAY_ELEMENT                                ~11     $12
   36    40        NEW                                              $14     'Artist'
         41        SEND_VAL_EX                                              'Titian'
         42        DO_FCALL                                      0          
         43        ADD_ARRAY_ELEMENT                                ~11     $14
   33    44        ASSIGN                                                   !0, ~11
   38    45        INIT_FCALL                                               'var_dump'
         46        INIT_FCALL                                               'array_column'
         47        SEND_VAR                                                 !0
         48        SEND_VAL                                                 'artist_name'
         49        DO_ICALL                                         $17     
         50        SEND_VAR                                                 $17
         51        DO_ICALL                                                 
   39    52      > RETURN                                                   1

Function %00array_column%2Fin%2FUa1SU%3A3%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/Ua1SU
function name:  array_column
number of ops:  19
compiled vars:  !0 = $array, !1 = $column_key, !2 = $idx, !3 = $result, !4 = $item, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
    4     3        ASSIGN                                                   !3, <array>
    5     4      > FE_RESET_R                                       $7      !0, ->16
          5    > > FE_FETCH_R                                       ~8      $7, !4, ->16
          6    >   ASSIGN                                                   !5, ~8
    6     7      > JMPZ                                                     !2, ->11
          8    >   FETCH_DIM_R                                      ~10     !4, !2
          9        QM_ASSIGN                                        ~11     ~10
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~11     !5
         12    >   FETCH_DIM_R                                      ~13     !4, !1
         13        ASSIGN_DIM                                               !3, ~11
         14        OP_DATA                                                  ~13
    5    15      > JMP                                                      ->5
         16    >   FE_FREE                                                  $7
    8    17      > RETURN                                                   !3
    9    18*     > RETURN                                                   null

End of function %00array_column%2Fin%2FUa1SU%3A3%240

Class Artist:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ua1SU
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'artist_name'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ua1SU
function name:  offsetGet
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        FETCH_OBJ_R                                      ~1      !0
          2      > RETURN                                                   ~1
   21     3*     > RETURN                                                   null

End of function offsetget

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ua1SU
function name:  offsetExists
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
          2      > RETURN                                                   ~1
   24     3*     > RETURN                                                   null

End of function offsetexists

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ua1SU
function name:  offsetSet
number of ops:  5
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        ASSIGN_OBJ                                               !0
          3        OP_DATA                                                  !1
   27     4      > RETURN                                                   null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ua1SU
function name:  offsetUnset
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        UNSET_OBJ                                                !0
   30     2      > RETURN                                                   null

End of function offsetunset

End of class Artist.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.75 ms | 1404 KiB | 23 Q