3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get the original answer $answer = $output['answer']; // Get gold price from external API // // https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json $start_date = date('Y-m-d', strtotime('-3 days')); $json_string = file_get_contents("https://www.quandl.com/api/v3/datasets/WSJ/AU_HHB.json?start_date=$start_date"); $json_object = json_decode($json_string,true); $gold_price = $json_object['dataset']['data'][0]['1']; // Update the answer by filling the gap XXXX with the actual value of gold $answer = str_replace('XXXX', $gold_price , $answer); // send the answer to Alexa $output['answer'] = $answer; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NQljQ
function name:  (null)
number of ops:  35
compiled vars:  !0 = $answer, !1 = $output, !2 = $start_date, !3 = $json_string, !4 = $json_object, !5 = $gold_price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_DIM_R                                      ~6      !1, 'answer'
          1        ASSIGN                                                   !0, ~6
    8     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'Y-m-d'
          4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 '-3+days'
          6        DO_ICALL                                         $8      
          7        SEND_VAR                                                 $8
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
    9    10        INIT_FCALL                                               'file_get_contents'
         11        NOP                                                      
         12        FAST_CONCAT                                      ~11     'https%3A%2F%2Fwww.quandl.com%2Fapi%2Fv3%2Fdatasets%2FWSJ%2FAU_HHB.json%3Fstart_date%3D', !2
         13        SEND_VAL                                                 ~11
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !3, $12
   10    16        INIT_FCALL                                               'json_decode'
         17        SEND_VAR                                                 !3
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !4, $14
   11    21        FETCH_DIM_R                                      ~16     !4, 'dataset'
         22        FETCH_DIM_R                                      ~17     ~16, 'data'
         23        FETCH_DIM_R                                      ~18     ~17, 0
         24        FETCH_DIM_R                                      ~19     ~18, 1
         25        ASSIGN                                                   !5, ~19
   14    26        INIT_FCALL                                               'str_replace'
         27        SEND_VAL                                                 'XXXX'
         28        SEND_VAR                                                 !5
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $21     
         31        ASSIGN                                                   !0, $21
   17    32        ASSIGN_DIM                                               !1, 'answer'
         33        OP_DATA                                                  !0
   19    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.77 ms | 1401 KiB | 23 Q