3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://api.appannie.com/v1.2/accounts'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Authorization: Bearer 713fe46c23f089d841c0809c9df0fce0a37bb2cd' )); $run = curl_exec($ch); curl_close($ch); $arr = json_decode($run, true); // print_r($arr); $account_ids = array(); foreach($arr['accounts'] as $account) { $account_ids[] = $account['account_id']; // $account_id = $account['account_id']; // $ch2 = curl_init(); // curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch2, CURLOPT_URL, 'https://api.appannie.com/v1.2/accounts/' . $account_id . '/sales?break_down=product&start_date=2015-01-01&end_date=2015-01-31'); // curl_setopt($ch2, CURLOPT_HTTPHEADER, array( // 'Content-Type: application/json', // 'Authorization: Bearer 8a2d2958e05107d04ac4bb25687dfb2b56366de7' // )); // $run2 = curl_exec($ch2); // curl_close($ch2); // $arr2 = json_decode($run2, true); // print_r($arr2); // // foreach($arr2['account_id'] as $account_id2){ // // $account_ids[] = $account_id2; // } } foreach($account_ids as $account_id){ $ch2 = curl_init(); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch2, CURLOPT_URL, 'https://api.appannie.com/v1.2/accounts/' . $account_id . '/sales?break_down=product&start_date=2015-01-01&end_date=2015-01-31'); curl_setopt($ch2, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Authorization: Bearer 8a2d2958e05107d04ac4bb25687dfb2b56366de7' )); $run2 = curl_exec($ch2); curl_close($ch2); $arr2 = json_decode($run2, true); } $product_ids = array(); foreach($arr2['sales_list'] as $sales_list) { $product_ids[] = $sales_list['product_id']; } print_r($product_ids); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 41
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 80
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 80
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 80
2 jumps found. (Code = 77) Position 1 = 84, Position 2 = 89
Branch analysis from position: 84
2 jumps found. (Code = 78) Position 1 = 85, Position 2 = 89
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 89
Branch analysis from position: 80
Branch analysis from position: 41
filename:       /in/cX8m3
function name:  (null)
number of ops:  94
compiled vars:  !0 = $ch, !1 = $run, !2 = $arr, !3 = $account_ids, !4 = $account, !5 = $account_id, !6 = $ch2, !7 = $run2, !8 = $arr2, !9 = $product_ids, !10 = $sales_list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'curl_init'
          1        DO_FCALL                                      0  $11     
          2        ASSIGN                                                   !0, $11
    3     3        INIT_FCALL_BY_NAME                                       'curl_setopt'
          4        SEND_VAR_EX                                              !0
          5        FETCH_CONSTANT                                   ~13     'CURLOPT_RETURNTRANSFER'
          6        SEND_VAL_EX                                              ~13
          7        SEND_VAL_EX                                              <true>
          8        DO_FCALL                                      0          
    4     9        INIT_FCALL_BY_NAME                                       'curl_setopt'
         10        SEND_VAR_EX                                              !0
         11        FETCH_CONSTANT                                   ~15     'CURLOPT_URL'
         12        SEND_VAL_EX                                              ~15
         13        SEND_VAL_EX                                              'https%3A%2F%2Fapi.appannie.com%2Fv1.2%2Faccounts'
         14        DO_FCALL                                      0          
    5    15        INIT_FCALL_BY_NAME                                       'curl_setopt'
         16        SEND_VAR_EX                                              !0
         17        FETCH_CONSTANT                                   ~17     'CURLOPT_HTTPHEADER'
         18        SEND_VAL_EX                                              ~17
    6    19        SEND_VAL_EX                                              <array>
         20        DO_FCALL                                      0          
    9    21        INIT_FCALL_BY_NAME                                       'curl_exec'
         22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0  $19     
         24        ASSIGN                                                   !1, $19
   10    25        INIT_FCALL_BY_NAME                                       'curl_close'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0          
   11    28        INIT_FCALL                                               'json_decode'
         29        SEND_VAR                                                 !1
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !2, $22
   16    33        ASSIGN                                                   !3, <array>
   17    34        FETCH_DIM_R                                      ~25     !2, 'accounts'
         35      > FE_RESET_R                                       $26     ~25, ->41
         36    > > FE_FETCH_R                                               $26, !4, ->41
   20    37    >   FETCH_DIM_R                                      ~28     !4, 'account_id'
         38        ASSIGN_DIM                                               !3
         39        OP_DATA                                                  ~28
   17    40      > JMP                                                      ->36
         41    >   FE_FREE                                                  $26
   41    42      > FE_RESET_R                                       $29     !3, ->80
         43    > > FE_FETCH_R                                               $29, !5, ->80
   42    44    >   INIT_FCALL_BY_NAME                                       'curl_init'
         45        DO_FCALL                                      0  $30     
         46        ASSIGN                                                   !6, $30
   43    47        INIT_FCALL_BY_NAME                                       'curl_setopt'
         48        SEND_VAR_EX                                              !6
         49        FETCH_CONSTANT                                   ~32     'CURLOPT_RETURNTRANSFER'
         50        SEND_VAL_EX                                              ~32
         51        SEND_VAL_EX                                              <true>
         52        DO_FCALL                                      0          
   44    53        INIT_FCALL_BY_NAME                                       'curl_setopt'
         54        SEND_VAR_EX                                              !6
         55        FETCH_CONSTANT                                   ~34     'CURLOPT_URL'
         56        SEND_VAL_EX                                              ~34
         57        CONCAT                                           ~35     'https%3A%2F%2Fapi.appannie.com%2Fv1.2%2Faccounts%2F', !5
         58        CONCAT                                           ~36     ~35, '%2Fsales%3Fbreak_down%3Dproduct%26start_date%3D2015-01-01%26end_date%3D2015-01-31'
         59        SEND_VAL_EX                                              ~36
         60        DO_FCALL                                      0          
   45    61        INIT_FCALL_BY_NAME                                       'curl_setopt'
         62        SEND_VAR_EX                                              !6
         63        FETCH_CONSTANT                                   ~38     'CURLOPT_HTTPHEADER'
         64        SEND_VAL_EX                                              ~38
   46    65        SEND_VAL_EX                                              <array>
         66        DO_FCALL                                      0          
   49    67        INIT_FCALL_BY_NAME                                       'curl_exec'
         68        SEND_VAR_EX                                              !6
         69        DO_FCALL                                      0  $40     
         70        ASSIGN                                                   !7, $40
   50    71        INIT_FCALL_BY_NAME                                       'curl_close'
         72        SEND_VAR_EX                                              !6
         73        DO_FCALL                                      0          
   51    74        INIT_FCALL                                               'json_decode'
         75        SEND_VAR                                                 !7
         76        SEND_VAL                                                 <true>
         77        DO_ICALL                                         $43     
         78        ASSIGN                                                   !8, $43
   41    79      > JMP                                                      ->43
         80    >   FE_FREE                                                  $29
   54    81        ASSIGN                                                   !9, <array>
   56    82        FETCH_DIM_R                                      ~46     !8, 'sales_list'
         83      > FE_RESET_R                                       $47     ~46, ->89
         84    > > FE_FETCH_R                                               $47, !10, ->89
   57    85    >   FETCH_DIM_R                                      ~49     !10, 'product_id'
         86        ASSIGN_DIM                                               !9
         87        OP_DATA                                                  ~49
   56    88      > JMP                                                      ->84
         89    >   FE_FREE                                                  $47
   60    90        INIT_FCALL                                               'print_r'
         91        SEND_VAR                                                 !9
         92        DO_ICALL                                                 
   61    93      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.8 ms | 1404 KiB | 17 Q