3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getTweets($hash_tag) { $url = 'http://search.twitter.com/search.atom?q='.urlencode($hash_tag) ; echo "<p>Connecting to <strong>$url</strong> ...</p>"; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $xml = curl_exec ($ch); curl_close ($ch); //If you want to see the response from Twitter, uncomment this next part out: echo "<p>Response:</p>"; echo "<pre>".htmlspecialchars($xml)."</pre>"; $affected = 0; $twelement = new SimpleXMLElement($xml); foreach ($twelement->entry as $entry) { $text = trim($entry->title); $author = trim($entry->author->name); $time = strtotime($entry->published); $id = $entry->id; echo "<p>Tweet from ".$author.": <strong>".$text."</strong> <em>Posted ".date('n/j/y g:i a',$time)."</em></p>"; } return true ; } getTweets('#cats'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1fLWo
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'gettweets'
          1        SEND_VAL                                                 '%23cats'
          2        DO_FCALL                                      0          
   29     3      > RETURN                                                   1

Function gettweets:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 72
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 72
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
filename:       /in/1fLWo
function name:  getTweets
number of ops:  75
compiled vars:  !0 = $hash_tag, !1 = $url, !2 = $ch, !3 = $xml, !4 = $affected, !5 = $twelement, !6 = $entry, !7 = $text, !8 = $author, !9 = $time, !10 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'urlencode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $11     
          4        CONCAT                                           ~12     'http%3A%2F%2Fsearch.twitter.com%2Fsearch.atom%3Fq%3D', $11
          5        ASSIGN                                                   !1, ~12
    5     6        ROPE_INIT                                     3  ~15     '%3Cp%3EConnecting+to+%3Cstrong%3E'
          7        ROPE_ADD                                      1  ~15     ~15, !1
          8        ROPE_END                                      2  ~14     ~15, '%3C%2Fstrong%3E+...%3C%2Fp%3E'
          9        ECHO                                                     ~14
    6    10        INIT_FCALL_BY_NAME                                       'curl_init'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $17     
         13        ASSIGN                                                   !2, $17
    7    14        INIT_FCALL_BY_NAME                                       'curl_setopt'
         15        SEND_VAR_EX                                              !2
         16        FETCH_CONSTANT                                   ~19     'CURLOPT_RETURNTRANSFER'
         17        SEND_VAL_EX                                              ~19
         18        SEND_VAL_EX                                              <true>
         19        DO_FCALL                                      0          
    8    20        INIT_FCALL_BY_NAME                                       'curl_exec'
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0  $21     
         23        ASSIGN                                                   !3, $21
    9    24        INIT_FCALL_BY_NAME                                       'curl_close'
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
   12    27        ECHO                                                     '%3Cp%3EResponse%3A%3C%2Fp%3E'
   13    28        INIT_FCALL                                               'htmlspecialchars'
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $24     
         31        CONCAT                                           ~25     '%3Cpre%3E', $24
         32        CONCAT                                           ~26     ~25, '%3C%2Fpre%3E'
         33        ECHO                                                     ~26
   15    34        ASSIGN                                                   !4, 0
   16    35        NEW                                              $28     'SimpleXMLElement'
         36        SEND_VAR_EX                                              !3
         37        DO_FCALL                                      0          
         38        ASSIGN                                                   !5, $28
   17    39        FETCH_OBJ_R                                      ~31     !5, 'entry'
         40      > FE_RESET_R                                       $32     ~31, ->72
         41    > > FE_FETCH_R                                               $32, !6, ->72
   18    42    >   INIT_FCALL                                               'trim'
         43        FETCH_OBJ_R                                      ~33     !6, 'title'
         44        SEND_VAL                                                 ~33
         45        DO_ICALL                                         $34     
         46        ASSIGN                                                   !7, $34
   19    47        INIT_FCALL                                               'trim'
         48        FETCH_OBJ_R                                      ~36     !6, 'author'
         49        FETCH_OBJ_R                                      ~37     ~36, 'name'
         50        SEND_VAL                                                 ~37
         51        DO_ICALL                                         $38     
         52        ASSIGN                                                   !8, $38
   20    53        INIT_FCALL                                               'strtotime'
         54        FETCH_OBJ_R                                      ~40     !6, 'published'
         55        SEND_VAL                                                 ~40
         56        DO_ICALL                                         $41     
         57        ASSIGN                                                   !9, $41
   21    58        FETCH_OBJ_R                                      ~43     !6, 'id'
         59        ASSIGN                                                   !10, ~43
   22    60        CONCAT                                           ~45     '%3Cp%3ETweet+from+', !8
         61        CONCAT                                           ~46     ~45, '%3A+%3Cstrong%3E'
         62        CONCAT                                           ~47     ~46, !7
         63        CONCAT                                           ~48     ~47, '%3C%2Fstrong%3E++%3Cem%3EPosted+'
         64        INIT_FCALL                                               'date'
         65        SEND_VAL                                                 'n%2Fj%2Fy+g%3Ai+a'
         66        SEND_VAR                                                 !9
         67        DO_ICALL                                         $49     
         68        CONCAT                                           ~50     ~48, $49
         69        CONCAT                                           ~51     ~50, '%3C%2Fem%3E%3C%2Fp%3E'
         70        ECHO                                                     ~51
   17    71      > JMP                                                      ->41
         72    >   FE_FREE                                                  $32
   25    73      > RETURN                                                   <true>
   26    74*     > RETURN                                                   null

End of function gettweets

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.83 ms | 1407 KiB | 24 Q