I am trying to add an array value to a new array like so:
$clientname[] = $cname['name'];
If I var_dump($cname['name']);
then everything appears fine, but if I var_dump($clientname);
I expect to see the same thing, but I don't, it appears as if I have done var_dump($cname);
The full code is here:
foreach($clientname as $client) {
foreach($client as $cname) {
var_dump($cname['name']);
$clientname[] = $cname['name'];
var_dump($clientname);
}
}
I have had to do the foreaches because of the array structure it is in, obviously the var_dump($cname['name']);
repeats for the amount of $cnames there is as expected
What can be causing my $clientname
to be a duplicate of $cname