3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument; // We don't want to bother with white spaces $doc->preserveWhiteSpace = false; $doc->strictErrorChecking = false; $doc->recover = true; $doc->loadHTMLFile('https://www.bloomberg.com/quote/USDJPY:CUR'); $xpath = new DOMXPath($doc); $query = "//meta[@itemprop='priceChangePercent']"; $entries = $xpath->query($query); foreach ($entries as $entry) { $result = trim($entry->getAttribute('content')); $ret_ = explode(' ', $result); //make sure every element in the array don't start or end with blank foreach ($ret_ as $key=>$val){ $ret_[$key]=trim($val); } //delete the empty element and the element is blank "\n" "\r" "\t" //I modify this line $ret_ = array_values(array_filter($ret_,deleteBlankInArray)); //echo the last element echo $ret_[0]; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 57
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 57
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 44
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 44
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 44
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
filename:       /in/HRh4h
function name:  (null)
number of ops:  59
compiled vars:  !0 = $doc, !1 = $xpath, !2 = $query, !3 = $entries, !4 = $entry, !5 = $result, !6 = $ret_, !7 = $val, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $9      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $9
    6     3        ASSIGN_OBJ                                               !0, 'preserveWhiteSpace'
          4        OP_DATA                                                  <false>
    8     5        ASSIGN_OBJ                                               !0, 'strictErrorChecking'
          6        OP_DATA                                                  <false>
    9     7        ASSIGN_OBJ                                               !0, 'recover'
          8        OP_DATA                                                  <true>
   11     9        INIT_METHOD_CALL                                         !0, 'loadHTMLFile'
         10        SEND_VAL_EX                                              'https%3A%2F%2Fwww.bloomberg.com%2Fquote%2FUSDJPY%3ACUR'
         11        DO_FCALL                                      0          
   15    12        NEW                                              $16     'DOMXPath'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $16
   17    16        ASSIGN                                                   !2, '%2F%2Fmeta%5B%40itemprop%3D%27priceChangePercent%27%5D'
   20    17        INIT_METHOD_CALL                                         !1, 'query'
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0  $20     
         20        ASSIGN                                                   !3, $20
   21    21      > FE_RESET_R                                       $22     !3, ->57
         22    > > FE_FETCH_R                                               $22, !4, ->57
   22    23    >   INIT_FCALL                                               'trim'
         24        INIT_METHOD_CALL                                         !4, 'getAttribute'
         25        SEND_VAL_EX                                              'content'
         26        DO_FCALL                                      0  $23     
         27        SEND_VAR                                                 $23
         28        DO_ICALL                                         $24     
         29        ASSIGN                                                   !5, $24
   23    30        INIT_FCALL                                               'explode'
         31        SEND_VAL                                                 '+'
         32        SEND_VAR                                                 !5
         33        DO_ICALL                                         $26     
         34        ASSIGN                                                   !6, $26
   25    35      > FE_RESET_R                                       $28     !6, ->44
         36    > > FE_FETCH_R                                       ~29     $28, !7, ->44
         37    >   ASSIGN                                                   !8, ~29
   26    38        INIT_FCALL                                               'trim'
         39        SEND_VAR                                                 !7
         40        DO_ICALL                                         $32     
         41        ASSIGN_DIM                                               !6, !8
         42        OP_DATA                                                  $32
   25    43      > JMP                                                      ->36
         44    >   FE_FREE                                                  $28
   30    45        INIT_FCALL                                               'array_values'
         46        INIT_FCALL                                               'array_filter'
         47        SEND_VAR                                                 !6
         48        FETCH_CONSTANT                                   ~33     'deleteBlankInArray'
         49        SEND_VAL                                                 ~33
         50        DO_ICALL                                         $34     
         51        SEND_VAR                                                 $34
         52        DO_ICALL                                         $35     
         53        ASSIGN                                                   !6, $35
   33    54        FETCH_DIM_R                                      ~37     !6, 0
         55        ECHO                                                     ~37
   21    56      > JMP                                                      ->22
         57    >   FE_FREE                                                  $22
   40    58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.93 ms | 1405 KiB | 21 Q