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'];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With