Forum Moderators: coopster
I'm trying to push some data into an array.
Right now the following code works:
array_push($news,$title,$link,$description,$author);
However, I would like to push the data into an array with labled keys. Something like:
array_push($news,"title"=>$title,"link"=>$link,"description"=>$description,"author"=>$author);
Any ideas?
That's correct, and further on in the manual page [php.net] there is a note:
Has the same effect as:
<?php
$array[] = $var;
?>
repeated for each var
So, you can do this and get the same effect:
$news["title"] = $title;
$news["link"] = $link;
$news["description"] = $description;
$news["author"] = $author;