tags:

views:

41

answers:

2

Hi,

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</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?

+2  A: 

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);
Raoul Duke
thanks Raoul! shoulda known that!
iamjonesy
A: 

If it doesn't matter if linebreaks are added, you can simply write:

<?php
$xml = array('sXML' => "<abc>
<def>Asdfg</def>
</abc>";
?>
matsolof