I've got a long string which I want to split accross multiple lines so it's easier to read. but I'm not sure what the syntax is
$xml = array('sXML' =>"<queryxml><entity>Ticket</entity><query><field>Status<expression op=\"$condition1\">$complete</expression></field><condition operator=\"AND\"><field>AccountID<expression op=\"equals\">$userid</expression></field></condition><condition operator=\"AND\"><condition><field>QueueID<expression op=\"NotEqual\">$routine<开发者_如何学C/expression></field></condition><condition operator=\"OR\"><field>QueueID<expression op=\"NotEqual\">$recurring</expression></field></condition><condition operator=\"OR\"><field>QueueID<expression op=\"NotEqual\">$clientmanagement</expression></field></condition></condition></query></queryxml>");
Can someone help me out please?
just split it into multiple strings and concatenate them, like this:
$xml = array('sXML' => "lorem" .
"ipsum" .
"dolor");
or use heredoc:
$sXML = <<<XML
your text
goes here
XML;
$xml = array('sXML' => $sXML);
If it doesn't matter if linebreaks are added, you can simply write:
<?php
$xml = array('sXML' => "<abc>
<def>Asdfg</def>
</abc>";
?>
精彩评论