Friday, 15 April 2011

twitter - PHP foreach how to access variable outside loop -


I have this code to tap in a Twitter feed ...

  // Output Tweets $ json = file_get_contents ("http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=false&screen_name=*********&&count=100 " , truth); $ Decode = json_decode ($ json, true); $ Count = count ($ decode); Calculating the number of conditions for // ($ i = 0; $ i & lt; $ count; $ i ++) {// echo $ decode [$ i] ["text"]. "& Lt; br & gt; & lt; br & gt;"; $ Text = $ decode [$ i] ["Text"]. ""; Repeat $ text; }   

I want to use $ text in another function. Can it be done?

There is only one array and insert it on each run of the loop, and then resonate it out or back.

  $ arr = array (); For ($ i = 0; $ i <$ count; $ i ++) {$ text = $ decode [$ i] ['text']; $ Arr [] = $ text; Resonate $ text ""; } Var_dump ($ arr);    

No comments:

Post a Comment