You are overwriting the value of $tweetfeed
in every itteration.
$tweetfeed = array (
'status' => $status
);
Should be:
$tweetfeed[] = array (
'status' => $status
);
By using []
you are pushing the value into the array, rather than overwriting it. You could actually simplify the whole thing to:
$tweetfeed = array();
foreach($users as $user){
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$user."&count=".$notweets);
$status = array();
foreach($tweets as $key) {
$status[]=array(
'text' => $key ->text,
'stamp' => twitter_time($key -> created_at)
);
}
$tweetfeed[] = array (
'status' => $status
);
var_dump($tweetfeed);
}
var_dump($tweetfeed);
16
solved Only last element of array is displayed [closed]