i want print results of search result in array. until can print out plain search results.
i use code print serch :
$response = json_decode($connection->response['response'],true); $tweet_data = $response['statuses']; $tweet_stream = ''; foreach($tweet_data $tweet) { $tweet_stream .= $tweet['text'] . '<br/>'; } print $tweet_stream;
will give print result :
tweet1 tweet2 .... tweetn
how change results in array?
thanks help.
i think asking
$response = json_decode($connection->response['response'],true); $tweet_data = $response['statuses']; $tweet_stream_arr = array(); foreach($tweet_data $tweet) { $tweet_stream_arr[] = $tweet['text']; } print_r($tweet_stream_arr);
you can little easier array_map though
$tweet_stream_text = array_map(function($tweet) { return $tweet['text']; }, $tweet_data); print_r($tweet_stream_text);
note requires php >= 5.3