3v4l.org

run code in 300+ PHP versions simultaneously
<?php $itineraries_params = array_reduce(array_map( function ($weekday) { return [ (object) [ 'weekday' => $weekday, 'arrival_time' => '09:00:00', 'from_address_id' => 1, 'to_address_id' => 2 ], (object) [ 'weekday' => $weekday, 'arrival_time' => '17:00:00', 'from_address_id' => 2, 'to_address_id' => 1 ] ]; }, range(1, 5) )); var_dump($itineraries_params); // vrs Ruby // // itineraries_params = (1..5).flat_map do |weekday| // [{ // weekday: weekday, // arrival_time: '09:00:00', // from_address_id: user.home_address.id, // to_address_id: user.work_address.id // }, { // weekday: weekday, // arrival_time: '17:00:00', // from_address_id: user.work_address.id, // to_address_id: user.home_address.id // }] // end
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5K9mh
function name:  (null)
number of ops:  17
compiled vars:  !0 = $itineraries_params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_reduce'
          1        INIT_FCALL                                               'array_map'
    4     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5K9mh%3A4%240'
   19     3        SEND_VAL                                                 ~1
   20     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 5
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
    3    12        ASSIGN                                                   !0, $4
   23    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
   39    16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F5K9mh%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5K9mh
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $weekday
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    7     1        INIT_ARRAY                                       ~1      !0, 'weekday'
    8     2        ADD_ARRAY_ELEMENT                                ~1      '09%3A00%3A00', 'arrival_time'
    9     3        ADD_ARRAY_ELEMENT                                ~1      1, 'from_address_id'
   10     4        ADD_ARRAY_ELEMENT                                ~1      2, 'to_address_id'
          5        CAST                                          8  ~2      ~1
          6        INIT_ARRAY                                       ~3      ~2
   13     7        INIT_ARRAY                                       ~4      !0, 'weekday'
   14     8        ADD_ARRAY_ELEMENT                                ~4      '17%3A00%3A00', 'arrival_time'
   15     9        ADD_ARRAY_ELEMENT                                ~4      2, 'from_address_id'
   16    10        ADD_ARRAY_ELEMENT                                ~4      1, 'to_address_id'
         11        CAST                                          8  ~5      ~4
         12        ADD_ARRAY_ELEMENT                                ~3      ~5
         13      > RETURN                                                   ~3
   19    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5K9mh%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.71 ms | 1396 KiB | 21 Q