3v4l.org

run code in 300+ PHP versions simultaneously
<?php function apiCall($url) { $data = null; // New prices uploaded if (get_transient("newPricesUploaded")) { // Get all cached API urls and delete them if (false !== ($transients = get_transient("apiCallTransients"))) { foreach ($transients as $transient) { delete_transient($transient); } delete_transient("apiCallTransients"); } // Reset set_transient("newPricesUploaded", 0, YEAR_IN_SECONDS); } if (false === ($data = get_transient(md5($url)))) { $data = file_get_contents($url); // Cache the request set_transient(md5($url), $data, 10800); // Update the apiCallTransients reference if (false !== ($transients = get_transient("apiCallTransients"))) { $transients[] = md5($url); } else { $transients = array(md5($url)); } set_transient("apiCallTransients", $transients, YEAR_IN_SECONDS); } return $data; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lIfKu
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E > > RETURN                                                   1

Function apicall:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 28
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 72
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 61
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
Branch analysis from position: 18
Branch analysis from position: 22
Branch analysis from position: 28
filename:       /in/lIfKu
function name:  apiCall
number of ops:  74
compiled vars:  !0 = $url, !1 = $data, !2 = $transients, !3 = $transient
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, null
    7     2        INIT_FCALL_BY_NAME                                       'get_transient'
          3        SEND_VAL_EX                                              'newPricesUploaded'
          4        DO_FCALL                                      0  $5      
          5      > JMPZ                                                     $5, ->28
   10     6    >   INIT_FCALL_BY_NAME                                       'get_transient'
          7        SEND_VAL_EX                                              'apiCallTransients'
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                           ~7      !2, $6
         10        TYPE_CHECK                                  1018          ~7
         11      > JMPZ                                                     ~8, ->22
   11    12    > > FE_RESET_R                                       $9      !2, ->18
         13    > > FE_FETCH_R                                               $9, !3, ->18
   12    14    >   INIT_FCALL_BY_NAME                                       'delete_transient'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0          
   11    17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $9
   14    19        INIT_FCALL_BY_NAME                                       'delete_transient'
         20        SEND_VAL_EX                                              'apiCallTransients'
         21        DO_FCALL                                      0          
   18    22    >   INIT_FCALL_BY_NAME                                       'set_transient'
         23        SEND_VAL_EX                                              'newPricesUploaded'
         24        SEND_VAL_EX                                              0
         25        FETCH_CONSTANT                                   ~12     'YEAR_IN_SECONDS'
         26        SEND_VAL_EX                                              ~12
         27        DO_FCALL                                      0          
   21    28    >   INIT_FCALL_BY_NAME                                       'get_transient'
         29        INIT_FCALL                                               'md5'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $14     
         32        SEND_VAR_NO_REF_EX                                       $14
         33        DO_FCALL                                      0  $15     
         34        ASSIGN                                           ~16     !1, $15
         35        TYPE_CHECK                                    4          ~16
         36      > JMPZ                                                     ~17, ->72
   22    37    >   INIT_FCALL                                               'file_get_contents'
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                         $18     
         40        ASSIGN                                                   !1, $18
   25    41        INIT_FCALL_BY_NAME                                       'set_transient'
         42        INIT_FCALL                                               'md5'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                         $20     
         45        SEND_VAR_NO_REF_EX                                       $20
         46        SEND_VAR_EX                                              !1
         47        SEND_VAL_EX                                              10800
         48        DO_FCALL                                      0          
   28    49        INIT_FCALL_BY_NAME                                       'get_transient'
         50        SEND_VAL_EX                                              'apiCallTransients'
         51        DO_FCALL                                      0  $22     
         52        ASSIGN                                           ~23     !2, $22
         53        TYPE_CHECK                                  1018          ~23
         54      > JMPZ                                                     ~24, ->61
   29    55    >   INIT_FCALL                                               'md5'
         56        SEND_VAR                                                 !0
         57        DO_ICALL                                         $26     
         58        ASSIGN_DIM                                               !2
         59        OP_DATA                                                  $26
         60      > JMP                                                      ->66
   31    61    >   INIT_FCALL                                               'md5'
         62        SEND_VAR                                                 !0
         63        DO_ICALL                                         $27     
         64        INIT_ARRAY                                       ~28     $27
         65        ASSIGN                                                   !2, ~28
   34    66    >   INIT_FCALL_BY_NAME                                       'set_transient'
         67        SEND_VAL_EX                                              'apiCallTransients'
         68        SEND_VAR_EX                                              !2
         69        FETCH_CONSTANT                                   ~30     'YEAR_IN_SECONDS'
         70        SEND_VAL_EX                                              ~30
         71        DO_FCALL                                      0          
   37    72    > > RETURN                                                   !1
   38    73*     > RETURN                                                   null

End of function apicall

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.54 ms | 1400 KiB | 17 Q