You have a string concatenation (.=
) syntax error. Change
$xml. = "<Contact>
to
$xml .= "<Contact>
I’m strictly answering the question about the “string concatenation” PHP error. No downvotes for anything except this point, please. But yes, try not to generate XML manually. I closed </Contact>
s for you below.
$xml="<Contacts>";
for ($i = 0; $i < count($results['records']); $i++) {
$xml .= "<Contact><Name>".$results['records'][$i]['name']."</Name></Contact>";
}
$xml.="</Contacts>";
1
solved String concatenation and JSON value cause error in PHP [closed]