3v4l.org

run code in 300+ PHP versions simultaneously
<?php //I set up 2 arrays, the $idArray to use in the 2nd API call and $testNull $idArray = array(); $testNull = array(); $results = [ ['id'=>1],['id'=>2],['id'=>3],['id'=>4], ['id'=>5],['id'=>6],['id'=>1],['id'=>8], ['id'=>9],['id'=>10],['id'=>11],['id'=>12], ['id'=>13],['id'=>14],['id'=>15],['id'=>16], ['id'=>17],['id'=>18],['id'=>19],['id'=>20], ]; //the JSON response is decoded previously and here I go through the first 20 results for($j = 0; $j < 20; $j++){ //Here I put the ID of each venue into $busID $busID = $results[$j]['id']; //In case the result is null I have set up this if statement if(!empty($busID)){ //This is echoing out the IDs of the venues correctly echo $busID; //and here the problem lies - just can't get the IDs in $idArray array_push($idArray, $busID); }else{ //I set this up just to test NUll responses from the 1st API call. array_push($testNull, $busID); } } var_dump($idArray); var_dump($testNull);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
Branch analysis from position: 5
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
Branch analysis from position: 5
filename:       /in/kb95I
function name:  (null)
number of ops:  31
compiled vars:  !0 = $idArray, !1 = $testNull, !2 = $results, !3 = $j, !4 = $busID
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN                                                   !2, <array>
   16     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->22
   18     5    >   FETCH_DIM_R                                      ~9      !2, !3
          6        FETCH_DIM_R                                      ~10     ~9, 'id'
          7        ASSIGN                                                   !4, ~10
   20     8        ISSET_ISEMPTY_CV                                 ~12     !4
          9        BOOL_NOT                                         ~13     ~12
         10      > JMPZ                                                     ~13, ->17
   22    11    >   ECHO                                                     !4
   24    12        INIT_FCALL                                               'array_push'
         13        SEND_REF                                                 !0
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                                 
         16      > JMP                                                      ->21
   27    17    >   INIT_FCALL                                               'array_push'
         18        SEND_REF                                                 !1
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
   16    21    >   PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, 20
         23      > JMPNZ                                                    ~17, ->5
   31    24    >   INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
   32    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.59 ms | 1396 KiB | 17 Q