On Tue, 20 Jul 2004 00:31:19 -0400, Jason Barnett <[EMAIL PROTECTED]> wrote:
> I was working on something else tonight when I literally stumbled across another
> solution that works here... pick your poison:
>
> <?php
> $heredoc = <<<XML
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <root>
> <node attribute="I am an attribute">
> <text>I am a text node.</text>
> </node>
> <dynamic>
> <string1>%1\$s</string1>
> <string1>%1\$s</string1>
> <string2>%2\$s</string2>
> <integer>%3\$d</integer>
> </dynamic>
> </root>
> XML;
>
> echo '<pre>';
> define ('string1', 'Well looky here, some text.');
> define ('string2', 'Man, I wish I could be a knight who said nee!');
> define ('integer', 123452345.23232);
>
> $xml = sprintf($heredoc, string1, string2, integer);
>
> print_r(htmlentities($xml));
>
> ?>
>
You don't need the print_r as it's a string.
Ugh, sprintf. It's a *lot* slower than using concatenation. Besides
which, you don't need that heredoc syntax. Just use quotes. PHP allows
you to have a newline in a quoted string.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php