3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tsId = 'X1C77CF6EE730D2E88A284D7203D1B20F'; $cacheFileName = '/tmp/'.$tsId.'.xml'; $cacheTimeOut = 43200; // half a day $apiUrl = 'http://www.trustedshops.com/api/ratings/v1/'.$tsId.'.xml'; $xmlFound = false; if ($xml = simplexml_load_file($apiUrl)) { $xPath = "/shop/ratings/result[@name='average']"; $result = (float) $xml -> xpath($xPath); $avg = $result[0]->asXml(); $max = "5.00"; $count = $xml->ratings["amount"]; $shopName = $xml->name; $xmlFound = true; } if ($xmlFound) { ?> <a href="http://www.trustedshops.eu/seller-rating/">Trusted Shops seller rating</a>:<span xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate"> <span rel="v:rating"><span property="v:value"><?php echo $avg;?> </span> </span> / <span property="v:best"><?php echo $max;?> </span> of <span property="v:count"><?php echo $count;?> </span> <a href="https://www.trustedshops.de/bewertung/info_<?php echo $tsId?>.html" title="<?php echo $shopName;?> bewertungen"><?php echo $shopName;?> ratings</a> </span> <?php } function cachecheck($filename_cache, $timeout = 10800) { if (file_exists($filename_cache) && time() - filemtime($filename_cache) < $timeout) { return true; } return false; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 45
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 31
filename:       /in/ccdIW
function name:  (null)
number of ops:  46
compiled vars:  !0 = $tsId, !1 = $cacheFileName, !2 = $cacheTimeOut, !3 = $apiUrl, !4 = $xmlFound, !5 = $xml, !6 = $xPath, !7 = $result, !8 = $avg, !9 = $max, !10 = $count, !11 = $shopName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'X1C77CF6EE730D2E88A284D7203D1B20F'
    4     1        CONCAT                                           ~13     '%2Ftmp%2F', !0
          2        CONCAT                                           ~14     ~13, '.xml'
          3        ASSIGN                                                   !1, ~14
    5     4        ASSIGN                                                   !2, 43200
    6     5        CONCAT                                           ~17     'http%3A%2F%2Fwww.trustedshops.com%2Fapi%2Fratings%2Fv1%2F', !0
          6        CONCAT                                           ~18     ~17, '.xml'
          7        ASSIGN                                                   !3, ~18
    8     8        ASSIGN                                                   !4, <false>
   11     9        INIT_FCALL                                               'simplexml_load_file'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $21     
         12        ASSIGN                                           ~22     !5, $21
         13      > JMPZ                                                     ~22, ->31
   12    14    >   ASSIGN                                                   !6, '%2Fshop%2Fratings%2Fresult%5B%40name%3D%27average%27%5D'
   13    15        INIT_METHOD_CALL                                         !5, 'xpath'
         16        SEND_VAR_EX                                              !6
         17        DO_FCALL                                      0  $24     
         18        CAST                                          5  ~25     $24
         19        ASSIGN                                                   !7, ~25
   14    20        FETCH_DIM_R                                      ~27     !7, 0
         21        INIT_METHOD_CALL                                         ~27, 'asXml'
         22        DO_FCALL                                      0  $28     
         23        ASSIGN                                                   !8, $28
   15    24        ASSIGN                                                   !9, '5.00'
   16    25        FETCH_OBJ_R                                      ~31     !5, 'ratings'
         26        FETCH_DIM_R                                      ~32     ~31, 'amount'
         27        ASSIGN                                                   !10, ~32
   17    28        FETCH_OBJ_R                                      ~34     !5, 'name'
         29        ASSIGN                                                   !11, ~34
   18    30        ASSIGN                                                   !4, <true>
   21    31    > > JMPZ                                                     !4, ->45
   22    32    >   ECHO                                                     '%3Ca+href%3D%22http%3A%2F%2Fwww.trustedshops.eu%2Fseller-rating%2F%22%3ETrusted+Shops+seller+rating%3C%2Fa%3E%3A%3Cspan+xmlns%3Av%3D%22http%3A%2F%2Frdf.data-vocabulary.org%2F%23%22+typeof%3D%22v%3AReview-aggregate%22%3E+%3Cspan+rel%3D%22v%3Arating%22%3E%3Cspan+property%3D%22v%3Avalue%22%3E'
         33        ECHO                                                     !8
         34        ECHO                                                     '+%3C%2Fspan%3E+%3C%2Fspan%3E+%2F+%3Cspan+property%3D%22v%3Abest%22%3E'
         35        ECHO                                                     !9
         36        ECHO                                                     '+%3C%2Fspan%3E+of+%3Cspan+property%3D%22v%3Acount%22%3E'
         37        ECHO                                                     !10
         38        ECHO                                                     '+%3C%2Fspan%3E+%3Ca+href%3D%22https%3A%2F%2Fwww.trustedshops.de%2Fbewertung%2Finfo_'
         39        ECHO                                                     !0
         40        ECHO                                                     '.html%22+title%3D%22'
         41        ECHO                                                     !11
         42        ECHO                                                     '+bewertungen%22%3E'
         43        ECHO                                                     !11
         44        ECHO                                                     '+ratings%3C%2Fa%3E+%3C%2Fspan%3E%0A'
   29    45    > > RETURN                                                   1

Function cachecheck:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/ccdIW
function name:  cachecheck
number of ops:  18
compiled vars:  !0 = $filename_cache, !1 = $timeout
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      10800
   25     2        INIT_FCALL                                               'file_exists'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5      > JMPZ_EX                                          ~3      $2, ->14
          6    >   INIT_FCALL                                               'time'
          7        DO_ICALL                                         $4      
          8        INIT_FCALL                                               'filemtime'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $5      
         11        SUB                                              ~6      $4, $5
         12        IS_SMALLER                                       ~7      ~6, !1
         13        BOOL                                             ~3      ~7
         14    > > JMPZ                                                     ~3, ->16
   26    15    > > RETURN                                                   <true>
   28    16    > > RETURN                                                   <false>
   29    17*     > RETURN                                                   null

End of function cachecheck

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.27 ms | 1400 KiB | 21 Q