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' ]; function array_string_multiply($array1, $array2) { foreach ($array1 as $field) { return array_map(function ($interval) use ($field) { return $field . $interval; }, $array2); } } foreach (array_string_multiply(array_keys($custom_fields), $time_intervals) as $key) { var_dump($key); } 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 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 25
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 16
filename:       /in/t8WiJ
function name:  (null)
number of ops:  32
compiled vars:  !0 = $custom_fields, !1 = $time_intervals, !2 = $data, !3 = $key, !4 = $name, !5 = $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>
   23     3        INIT_FCALL                                               'array_string_multiply'
          4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $9      
          7        SEND_VAR                                                 $9
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $10     
         10      > FE_RESET_R                                       $11     $10, ->16
         11    > > FE_FETCH_R                                               $11, !3, ->16
   24    12    >   INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
   23    15      > JMP                                                      ->11
         16    >   FE_FREE                                                  $11
   27    17        INIT_FCALL                                               'array_keys'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20      > FE_RESET_R                                       $14     $13, ->27
         21    > > FE_FETCH_R                                               $14, !4, ->27
   28    22    > > FE_RESET_R                                       $15     !1, ->25
         23    > > FE_FETCH_R                                               $15, !5, ->25
         24    > > JMP                                                      ->23
         25    >   FE_FREE                                                  $15
   27    26      > JMP                                                      ->21
         27    >   FE_FREE                                                  $14
   34    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
   36    31      > RETURN                                                   1

Function array_string_multiply:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/t8WiJ
function name:  array_string_multiply
number of ops:  15
compiled vars:  !0 = $array1, !1 = $array2, !2 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > FE_RESET_R                                       $3      !0, ->13
          3    > > FE_FETCH_R                                               $3, !2, ->13
   17     4    >   INIT_FCALL                                               'array_map'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft8WiJ%3A17%240'
          6        BIND_LEXICAL                                             ~4, !2
          7        SEND_VAL                                                 ~4
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        FE_FREE                                                  $3
         11      > RETURN                                                   $5
   16    12*       JMP                                                      ->3
         13    >   FE_FREE                                                  $3
   19    14      > RETURN                                                   null

End of function array_string_multiply

Function %00%7Bclosure%7D%2Fin%2Ft8WiJ%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t8WiJ
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%2Ft8WiJ%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.09 ms | 1394 KiB | 20 Q