2012-04-13 168 views
1
/* returns tweetDetails */ 
function returnTweets() 
{ 
    $return = array(); 
    $url = $hashtagSearchUrl = "http://search.twitter.com/search.json?q=%23gencsengeleceksin&include_entities=1&result_type=recent&rpp=50"; 
    foreach(json_decode(file_get_contents($url))->results as $t) 
    { 
     $return[] = $t; 
    } 

    return $return; 
} 

/* assigns tweet details to a variable */ 
$ts = returnTweets(); 

foreach ($ts as $t) 
    echo $t->id."<br />"; 

這必須輸出推文ID的列表。例如:返回浮點而不是整數

190914827918857531 
190914827918845655 
165456467265456156 

一般來說它的工作,但在一些服務器它的返回是這樣的:

1.9090219393785E+17 

我怎樣才能解決這個問題?

+1

將其轉換爲字符串。 – j08691 2012-04-13 21:02:20

+0

這裏是我的猜測:http://stackoverflow.com/questions/94591/what-is-the-maximum-value-for-a-int32 – Madbreaks 2012-04-13 21:02:28

+0

@ j08691,有什麼建議嗎? – Eray 2012-04-13 21:02:57

回答

2

可能在32位服務器上。

獲得財產id_str而不是id這將始終是一個字符串。

1

整數的大小取決於平臺。您應該使用字符串而不是數字來操作該數據。

相關問題