3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dataset = array( array( "product" => 4, "unit_amount" => "2020", "end_date" => date_timestamp_get(date_create("2020-07-12")) // Payment 1 Date ), array( "product" => 5, "unit_amount" => "2000", "end_date" => date_timestamp_get(date_create("2020-07-15")) //Payment 2 Date ), array( "product" => 6, "unit_amount" => "3400", "end_date" => date_timestamp_get(date_create("2020-07-16")) //Payment 3 Date ), array( "product" => 7, "unit_amount" => "3700", "end_date" => date_timestamp_get(date_create("2020-07-18")) //Payment 4 Date ), ); $phases = []; foreach ($dataset as $data) { $phases[] = [ 'end_date' => $data["end_date"], 'transfer_data' => [ 'amount_percent' => 20, 'destination' => 10], 'proration_behavior' => 'none', 'plans' => [ [ 'price_data' => [ 'unit_amount' => $data["unit_amount"], 'currency' => 'usd', 'product' => $data["product"], 'recurring' => [ 'interval' => 'month', ], ], ], ], ]; } $schedule_batch = array_chunk($phases, 2); $numberofbatches = count($schedule_batch); print_r($schedule_batch);

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 60
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 60
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
filename:       /in/FrVlQ
function name:  (null)
number of ops:  72
compiled vars:  !0 = $dataset, !1 = $phases, !2 = $data, !3 = $schedule_batch, !4 = $numberofbatches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_ARRAY                                       ~5      4, 'product'
    6     1        ADD_ARRAY_ELEMENT                                ~5      '2020', 'unit_amount'
    7     2        INIT_FCALL                                               'date_timestamp_get'
          3        INIT_FCALL                                               'date_create'
          4        SEND_VAL                                                 '2020-07-12'
          5        DO_ICALL                                         $6      
          6        SEND_VAR                                                 $6
          7        DO_ICALL                                         $7      
          8        ADD_ARRAY_ELEMENT                                ~5      $7, 'end_date'
          9        INIT_ARRAY                                       ~8      ~5
   11    10        INIT_ARRAY                                       ~9      5, 'product'
   12    11        ADD_ARRAY_ELEMENT                                ~9      '2000', 'unit_amount'
   13    12        INIT_FCALL                                               'date_timestamp_get'
         13        INIT_FCALL                                               'date_create'
         14        SEND_VAL                                                 '2020-07-15'
         15        DO_ICALL                                         $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                         $11     
         18        ADD_ARRAY_ELEMENT                                ~9      $11, 'end_date'
         19        ADD_ARRAY_ELEMENT                                ~8      ~9
   16    20        INIT_ARRAY                                       ~12     6, 'product'
   17    21        ADD_ARRAY_ELEMENT                                ~12     '3400', 'unit_amount'
   18    22        INIT_FCALL                                               'date_timestamp_get'
         23        INIT_FCALL                                               'date_create'
         24        SEND_VAL                                                 '2020-07-16'
         25        DO_ICALL                                         $13     
         26        SEND_VAR                                                 $13
         27        DO_ICALL                                         $14     
         28        ADD_ARRAY_ELEMENT                                ~12     $14, 'end_date'
         29        ADD_ARRAY_ELEMENT                                ~8      ~12
   21    30        INIT_ARRAY                                       ~15     7, 'product'
   22    31        ADD_ARRAY_ELEMENT                                ~15     '3700', 'unit_amount'
   23    32        INIT_FCALL                                               'date_timestamp_get'
         33        INIT_FCALL                                               'date_create'
         34        SEND_VAL                                                 '2020-07-18'
         35        DO_ICALL                                         $16     
         36        SEND_VAR                                                 $16
         37        DO_ICALL                                         $17     
         38        ADD_ARRAY_ELEMENT                                ~15     $17, 'end_date'
         39        ADD_ARRAY_ELEMENT                                ~8      ~15
    3    40        ASSIGN                                                   !0, ~8
   28    41        ASSIGN                                                   !1, <array>
   29    42      > FE_RESET_R                                       $20     !0, ->60
         43    > > FE_FETCH_R                                               $20, !2, ->60
   31    44    >   FETCH_DIM_R                                      ~22     !2, 'end_date'
         45        INIT_ARRAY                                       ~23     ~22, 'end_date'
         46        ADD_ARRAY_ELEMENT                                ~23     <array>, 'transfer_data'
   35    47        ADD_ARRAY_ELEMENT                                ~23     'none', 'proration_behavior'
   39    48        FETCH_DIM_R                                      ~24     !2, 'unit_amount'
         49        INIT_ARRAY                                       ~25     ~24, 'unit_amount'
   40    50        ADD_ARRAY_ELEMENT                                ~25     'usd', 'currency'
   41    51        FETCH_DIM_R                                      ~26     !2, 'product'
         52        ADD_ARRAY_ELEMENT                                ~25     ~26, 'product'
   31    53        ADD_ARRAY_ELEMENT                                ~25     <array>, 'recurring'
         54        INIT_ARRAY                                       ~27     ~25, 'price_data'
         55        INIT_ARRAY                                       ~28     ~27
         56        ADD_ARRAY_ELEMENT                                ~23     ~28, 'plans'
   30    57        ASSIGN_DIM                                               !1
   31    58        OP_DATA                                                  ~23
   29    59      > JMP                                                      ->43
         60    >   FE_FREE                                                  $20
   52    61        INIT_FCALL                                               'array_chunk'
         62        SEND_VAR                                                 !1
         63        SEND_VAL                                                 2
         64        DO_ICALL                                         $29     
         65        ASSIGN                                                   !3, $29
   53    66        COUNT                                            ~31     !3
         67        ASSIGN                                                   !4, ~31
   55    68        INIT_FCALL                                               'print_r'
         69        SEND_VAR                                                 !3
         70        DO_ICALL                                                 
         71      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.11 ms | 960 KiB | 17 Q