3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('array_column')) { function array_column($input, $column_key, $index_key = null) { if ($index_key !== null) { // Collect the keys $keys = array(); $i = 0; // Counter for numerical keys when key does not exist foreach ($input as $row) { if (array_key_exists($index_key, $row)) { // Update counter for numerical keys if (is_numeric($row[$index_key]) || is_bool($row[$index_key])) { $i = max($i, (int) $row[$index_key] + 1); } // Get the key from a single column of the array $keys[] = $row[$index_key]; } else { // The key does not exist, use numerical indexing $keys[] = $i++; } } } if ($column_key !== null) { // Collect the values $values = array(); $i = 0; // Counter for removing keys foreach ($input as $row) { if (array_key_exists($column_key, $row)) { // Get the values from a single column of the input array $values[] = $row[$column_key]; $i++; } elseif (isset($keys)) { // Values does not exist, also drop the key for it array_splice($keys, $i, 1); } } } else { // Get the full arrays $values = array_values($input); } if ($index_key !== null) { return array_combine($keys, $values); } return $values; } echo "Custom array_column()"; } $start = microtime(true); for ($i=0;$i<9999;$i++) { fmod(34, 4294967296); } $end = microtime(true); echo $end-$start."\n"; $start = microtime(true); for ($i=0;$i<9999;$i++) { bcmod('34', '4294967296'); } $end = microtime(true); echo $end-$start."\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 33
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 33
Branch analysis from position: 40
Branch analysis from position: 33
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/tpNjr
function name:  (null)
number of ops:  48
compiled vars:  !0 = $start, !1 = $i, !2 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'array_column'
          2        DO_ICALL                                         $3      
          3        BOOL_NOT                                         ~4      $3
          4      > JMPZ                                                     ~4, ->7
    3     5    >   DECLARE_FUNCTION                                         'array_column'
   52     6        ECHO                                                     'Custom+array_column%28%29'
   54     7    >   INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !0, $5
   55    11        ASSIGN                                                   !1, 0
         12      > JMP                                                      ->18
   56    13    >   INIT_FCALL                                               'fmod'
         14        SEND_VAL                                                 34
         15        SEND_VAL                                                 4294967296
         16        DO_ICALL                                                 
   55    17        PRE_INC                                                  !1
         18    >   IS_SMALLER                                               !1, 9999
         19      > JMPNZ                                                    ~10, ->13
   58    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !2, $11
   60    24        SUB                                              ~13     !2, !0
         25        CONCAT                                           ~14     ~13, '%0A'
         26        ECHO                                                     ~14
   62    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $15     
         30        ASSIGN                                                   !0, $15
   63    31        ASSIGN                                                   !1, 0
         32      > JMP                                                      ->38
   64    33    >   INIT_FCALL_BY_NAME                                       'bcmod'
         34        SEND_VAL_EX                                              '34'
         35        SEND_VAL_EX                                              '4294967296'
         36        DO_FCALL                                      0          
   63    37        PRE_INC                                                  !1
         38    >   IS_SMALLER                                               !1, 9999
         39      > JMPNZ                                                    ~20, ->33
   66    40    >   INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $21     
         43        ASSIGN                                                   !2, $21
   68    44        SUB                                              ~23     !2, !0
         45        CONCAT                                           ~24     ~23, '%0A'
         46        ECHO                                                     ~24
         47      > RETURN                                                   1

Function %00array_column%2Fin%2FtpNjr%3A3%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 37
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 36
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 36
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 28
Branch analysis from position: 19
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 60
Branch analysis from position: 39
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 58
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 58
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 50
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 57
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 71
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 71
Branch analysis from position: 66
Branch analysis from position: 71
Branch analysis from position: 36
Branch analysis from position: 37
filename:       /in/tpNjr
function name:  array_column
number of ops:  73
compiled vars:  !0 = $input, !1 = $column_key, !2 = $index_key, !3 = $keys, !4 = $i, !5 = $row, !6 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
    5     3        TYPE_CHECK                                  1020          !2
          4      > JMPZ                                                     ~7, ->37
    7     5    >   ASSIGN                                                   !3, <array>
    8     6        ASSIGN                                                   !4, 0
   10     7      > FE_RESET_R                                       $10     !0, ->36
          8    > > FE_FETCH_R                                               $10, !5, ->36
   11     9    >   ARRAY_KEY_EXISTS                                         !2, !5
         10      > JMPZ                                                     ~11, ->32
   13    11    >   INIT_FCALL                                               'is_numeric'
         12        FETCH_DIM_R                                      ~12     !5, !2
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                         $13     
         15      > JMPNZ_EX                                         ~14     $13, ->19
         16    >   FETCH_DIM_R                                      ~15     !5, !2
         17        TYPE_CHECK                                   12  ~16     ~15
         18        BOOL                                             ~14     ~16
         19    > > JMPZ                                                     ~14, ->28
   14    20    >   INIT_FCALL                                               'max'
         21        SEND_VAR                                                 !4
         22        FETCH_DIM_R                                      ~17     !5, !2
         23        CAST                                          4  ~18     ~17
         24        ADD                                              ~19     ~18, 1
         25        SEND_VAL                                                 ~19
         26        DO_ICALL                                         $20     
         27        ASSIGN                                                   !4, $20
   18    28    >   FETCH_DIM_R                                      ~23     !5, !2
         29        ASSIGN_DIM                                               !3
         30        OP_DATA                                                  ~23
         31      > JMP                                                      ->35
   21    32    >   POST_INC                                         ~25     !4
         33        ASSIGN_DIM                                               !3
         34        OP_DATA                                                  ~25
   10    35    > > JMP                                                      ->8
         36    >   FE_FREE                                                  $10
   26    37    >   TYPE_CHECK                                  1020          !1
         38      > JMPZ                                                     ~26, ->60
   28    39    >   ASSIGN                                                   !6, <array>
   29    40        ASSIGN                                                   !4, 0
   31    41      > FE_RESET_R                                       $29     !0, ->58
         42    > > FE_FETCH_R                                               $29, !5, ->58
   32    43    >   ARRAY_KEY_EXISTS                                         !1, !5
         44      > JMPZ                                                     ~30, ->50
   34    45    >   FETCH_DIM_R                                      ~32     !5, !1
         46        ASSIGN_DIM                                               !6
         47        OP_DATA                                                  ~32
   35    48        PRE_INC                                                  !4
         49      > JMP                                                      ->57
   36    50    >   ISSET_ISEMPTY_CV                                         !3
         51      > JMPZ                                                     ~34, ->57
   38    52    >   INIT_FCALL                                               'array_splice'
         53        SEND_REF                                                 !3
         54        SEND_VAR                                                 !4
         55        SEND_VAL                                                 1
         56        DO_ICALL                                                 
   31    57    > > JMP                                                      ->42
         58    >   FE_FREE                                                  $29
         59      > JMP                                                      ->64
   43    60    >   INIT_FCALL                                               'array_values'
         61        SEND_VAR                                                 !0
         62        DO_ICALL                                         $36     
         63        ASSIGN                                                   !6, $36
   46    64    >   TYPE_CHECK                                  1020          !2
         65      > JMPZ                                                     ~38, ->71
   47    66    >   INIT_FCALL                                               'array_combine'
         67        SEND_VAR                                                 !3
         68        SEND_VAR                                                 !6
         69        DO_ICALL                                         $39     
         70      > RETURN                                                   $39
   50    71    > > RETURN                                                   !6
   51    72*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.11 ms | 1413 KiB | 29 Q