3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ticketTypes = [ "ticketTypes" => [ "557968" => [ "section" => "235606", "amount" => "1" ], "604142"=> [ "section"=> "253594", "amount"=> "2" ] ], "delivery"=> [ "digitalPrintPass", "willcall", "mail", "digitalPrintPass" ] ]; $resultTypes = []; $deliveryOptions = []; $deliveryValues = ""; foreach ($ticketTypes as $key => $value) { if($key == 'ticketTypes'){ // print_r($key); -- printing "tickettypes" // print_r($value); $i = 0; foreach($value as $ticketTypeId => $sectionInfo){ $resultTypes[$i] = [ "ticketTypeId" => $ticketTypeId, "sectionId" => $sectionInfo['section'], "sectionAmount" => $sectionInfo['amount'] ]; $i++; } print_r($resultTypes); }elseif($key == 'delivery'){ foreach($value as $deliveryOption){ switch ($deliveryOption) { case "digitalPrintPass": $deliveryOptions[] = 'H'; break; case "willcall": $deliveryOptions[] = 'W'; break; case "mail": $deliveryOptions[] = 'M'; break; } } $deliveryValues = implode(",", $deliveryOptions); // $resultTypes[0] = [] } echo $deliveryValues; } // DONE -----> expect an array of price types (TICKET_TYPE) matched with a section and a quantity // DONE -----> create an empty array called something like matchingRequests // loop through all requests still in "REQUESTED" (see WAITLIST_STATUS table) state (possibly limited only to requests with selected price types), ordered by earliest submission time first. waitlist status table requested is id 1 // SQL_BSWAITLISTREPORTGET is a good starting point to find these requests, but we might want to make this a function in the waitlist class // if a request cannot be fulfilled in full (ticket type wasn't selected or quantity is no longer available) skip it // if the request can be fulfilled, include it in the matchingRequests array and decrement requested quantity for the section // return the matchingRequests as a json object // $a = json_encode($b); // echo $a; // $a = { // "ticketTypes": { // "557968": { // "section": "235606", // "amount": "1" // }, // "604142": { // "section": "253594", // "amount": "2" // } // }, // "delivery": { // "digitalPrintPass", // "willcall" // } // };
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 57
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 57
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 22
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 55
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 49
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 49
Branch analysis from position: 31
5 jumps found. (Code = 188) Position 1 = 39, Position 2 = 42, Position 3 = 45, Position 4 = 48, Position 5 = 32
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 48
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 39
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 45
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 45
Branch analysis from position: 42
Branch analysis from position: 39
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 49
Branch analysis from position: 55
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
filename:       /in/10hig
function name:  (null)
number of ops:  59
compiled vars:  !0 = $ticketTypes, !1 = $resultTypes, !2 = $deliveryOptions, !3 = $deliveryValues, !4 = $value, !5 = $key, !6 = $i, !7 = $sectionInfo, !8 = $ticketTypeId, !9 = $deliveryOption
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   22     2        ASSIGN                                                   !2, <array>
   23     3        ASSIGN                                                   !3, ''
   25     4      > FE_RESET_R                                       $14     !0, ->57
          5    > > FE_FETCH_R                                       ~15     $14, !4, ->57
          6    >   ASSIGN                                                   !5, ~15
   26     7        IS_EQUAL                                                 !5, 'ticketTypes'
          8      > JMPZ                                                     ~17, ->27
   31     9    >   ASSIGN                                                   !6, 0
   32    10      > FE_RESET_R                                       $19     !4, ->22
         11    > > FE_FETCH_R                                       ~20     $19, !7, ->22
         12    >   ASSIGN                                                   !8, ~20
   34    13        INIT_ARRAY                                       ~23     !8, 'ticketTypeId'
   35    14        FETCH_DIM_R                                      ~24     !7, 'section'
         15        ADD_ARRAY_ELEMENT                                ~23     ~24, 'sectionId'
   36    16        FETCH_DIM_R                                      ~25     !7, 'amount'
         17        ADD_ARRAY_ELEMENT                                ~23     ~25, 'sectionAmount'
   33    18        ASSIGN_DIM                                               !1, !6
   36    19        OP_DATA                                                  ~23
   38    20        PRE_INC                                                  !6
   32    21      > JMP                                                      ->11
         22    >   FE_FREE                                                  $19
   41    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
         26      > JMP                                                      ->55
   43    27    >   IS_EQUAL                                                 !5, 'delivery'
         28      > JMPZ                                                     ~28, ->55
   45    29    > > FE_RESET_R                                       $29     !4, ->49
         30    > > FE_FETCH_R                                               $29, !9, ->49
   47    31    > > SWITCH_STRING                                            !9, [ 'digitalPrintPass':->39, 'willcall':->42, 'mail':->45, ], ->48
   48    32    >   IS_EQUAL                                                 !9, 'digitalPrintPass'
         33      > JMPNZ                                                    ~30, ->39
   51    34    >   IS_EQUAL                                                 !9, 'willcall'
         35      > JMPNZ                                                    ~30, ->42
   54    36    >   IS_EQUAL                                                 !9, 'mail'
         37      > JMPNZ                                                    ~30, ->45
         38    > > JMP                                                      ->48
   49    39    >   ASSIGN_DIM                                               !2
         40        OP_DATA                                                  'H'
   50    41      > JMP                                                      ->48
   52    42    >   ASSIGN_DIM                                               !2
         43        OP_DATA                                                  'W'
   53    44      > JMP                                                      ->48
   55    45    >   ASSIGN_DIM                                               !2
         46        OP_DATA                                                  'M'
   56    47      > JMP                                                      ->48
   45    48    > > JMP                                                      ->30
         49    >   FE_FREE                                                  $29
   60    50        INIT_FCALL                                               'implode'
         51        SEND_VAL                                                 '%2C'
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                         $34     
         54        ASSIGN                                                   !3, $34
   65    55    >   ECHO                                                     !3
   25    56      > JMP                                                      ->5
         57    >   FE_FREE                                                  $14
  107    58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.87 ms | 1400 KiB | 17 Q