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('#ResearchOpinions'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0A3PE
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                                                 '%23ResearchOpinions'
          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 = 34, Position 2 = 65
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 65
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
filename:       /in/0A3PE
function name:  getTweets
number of ops:  68
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          
   15    27        ASSIGN                                                   !4, 0
   16    28        NEW                                              $25     'SimpleXMLElement'
         29        SEND_VAR_EX                                              !3
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !5, $25
   17    32        FETCH_OBJ_R                                      ~28     !5, 'entry'
         33      > FE_RESET_R                                       $29     ~28, ->65
         34    > > FE_FETCH_R                                               $29, !6, ->65
   18    35    >   INIT_FCALL                                               'trim'
         36        FETCH_OBJ_R                                      ~30     !6, 'title'
         37        SEND_VAL                                                 ~30
         38        DO_ICALL                                         $31     
         39        ASSIGN                                                   !7, $31
   19    40        INIT_FCALL                                               'trim'
         41        FETCH_OBJ_R                                      ~33     !6, 'author'
         42        FETCH_OBJ_R                                      ~34     ~33, 'name'
         43        SEND_VAL                                                 ~34
         44        DO_ICALL                                         $35     
         45        ASSIGN                                                   !8, $35
   20    46        INIT_FCALL                                               'strtotime'
         47        FETCH_OBJ_R                                      ~37     !6, 'published'
         48        SEND_VAL                                                 ~37
         49        DO_ICALL                                         $38     
         50        ASSIGN                                                   !9, $38
   21    51        FETCH_OBJ_R                                      ~40     !6, 'id'
         52        ASSIGN                                                   !10, ~40
   22    53        CONCAT                                           ~42     '%3Cp%3ETweet+from+', !8
         54        CONCAT                                           ~43     ~42, '%3A+%3Cstrong%3E'
         55        CONCAT                                           ~44     ~43, !7
         56        CONCAT                                           ~45     ~44, '%3C%2Fstrong%3E++%3Cem%3EPosted+'
         57        INIT_FCALL                                               'date'
         58        SEND_VAL                                                 'n%2Fj%2Fy+g%3Ai+a'
         59        SEND_VAR                                                 !9
         60        DO_ICALL                                         $46     
         61        CONCAT                                           ~47     ~45, $46
         62        CONCAT                                           ~48     ~47, '%3C%2Fem%3E%3C%2Fp%3E'
         63        ECHO                                                     ~48
   17    64      > JMP                                                      ->34
         65    >   FE_FREE                                                  $29
   25    66      > RETURN                                                   <true>
   26    67*     > RETURN                                                   null

End of function gettweets

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.82 ms | 1403 KiB | 22 Q