Fill an array using a foreach loop

I'm trying to fill an array with my foreach loop, but I don't get it to work. What am I doing wrong?

$a = array();

$activities = Project::getProjectnames($_DB, $projectnaam);
if(!empty($activities)) {
    foreach($activities as $k => $v) {
          $a .= array_fill($v['name']);

All I get back is the string Array...


you're concatenating a string there. You need to push the item into the array.

   foreach($activities as $k => $v) {
          $a[] = $v['name'];

Need Your Help

How to trace sql commands for a specific connection to db2?

java hibernate db2 trace sqlconnection

I am in the process of setting up a central build server. The server is responsible to produce the official build artifacts that will be deployed to all environment. For one of the applications the...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.