I have the following array content:
Array ( [achternaam] => Jansen [roepnaam] => Theo )
Now i want to use this code
foreach ($values as $r) {
$achternaam = $r['achternaam'];
$roepnaam = $r['roepnaam'];
}
When want to echo the $achternaam and $voornaam the values are empty.
Does anyone know how to bind this variables to eachother.
The result should be $achternaam = Jansen and $roepnaam = Theo.
Tnx for helping!
The elements of
$valuesare strings, not arrays. To access theachternaamandroepnaamvalues, you need to remove the foreach:If the positions of the
achternaamandroepnaamkeys do not change, you may uselistas well:This is only possible if the keys are in the order
achternaam,roepnaam. I.e.$values['achternaam']needs to assigned before$values['roepnaam'].