3v4l.org

run code in 300+ PHP versions simultaneously
<?php $custom_fields = [ 'foo' => '17', ]; $time_intervals = ['day', 'month', 'year', 'hour', 'minute', 'period']; $data = [ 'fooday' => '17', 'foomonth' => 'March', 'name' => 'Chris' ]; $values = []; foreach (array_keys($custom_fields) as $field) { $values += array_map(function ($interval) use ($field) { return $field . $interval; }, $time_intervals); } var_dump($values); foreach (array_keys($custom_fields) as $name) { foreach ($time_intervals as $interval_name) { // ; } } var_dump($data); // Result should be array that only contains $data['name'] = 'Chris'
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 29
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 17
filename:       /in/d93AF
function name:  (null)
number of ops:  36
compiled vars:  !0 = $custom_fields, !1 = $time_intervals, !2 = $data, !3 = $values, !4 = $field, !5 = $name, !6 = $interval_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, <array>
   15     3        ASSIGN                                                   !3, <array>
   16     4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $11     
          7      > FE_RESET_R                                       $12     $11, ->17
          8    > > FE_FETCH_R                                               $12, !4, ->17
   17     9    >   INIT_FCALL                                               'array_map'
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd93AF%3A17%240'
         11        BIND_LEXICAL                                             ~13, !4
         12        SEND_VAL                                                 ~13
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $14     
         15        ASSIGN_OP                                     1          !3, $14
   16    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $12
   20    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                                 
   22    21        INIT_FCALL                                               'array_keys'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $17     
         24      > FE_RESET_R                                       $18     $17, ->31
         25    > > FE_FETCH_R                                               $18, !5, ->31
   23    26    > > FE_RESET_R                                       $19     !1, ->29
         27    > > FE_FETCH_R                                               $19, !6, ->29
         28    > > JMP                                                      ->27
         29    >   FE_FREE                                                  $19
   22    30      > JMP                                                      ->25
         31    >   FE_FREE                                                  $18
   29    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
   31    35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fd93AF%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d93AF
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $interval, !1 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        CONCAT                                           ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd93AF%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.51 ms | 1400 KiB | 19 Q