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

Function array_string_multiply:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 13
filename:       /in/HrmUV
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      
          2        GENERATOR_CREATE                                         
   16     3      > FE_RESET_R                                       $3      !0, ->13
          4    > > FE_FETCH_R                                               $3, !2, ->13
   17     5    >   INIT_FCALL                                               'array_map'
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHrmUV%3A17%240'
          7        BIND_LEXICAL                                             ~4, !2
          8        SEND_VAL                                                 ~4
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $5      
         11        YIELD                                                    $5
   16    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $3
   19    14      > GENERATOR_RETURN                                         

End of function array_string_multiply

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.22 ms | 1403 KiB | 20 Q