note 43690 deleted from language.types.string by colder
| From: | colder@php.net | Date: | Tue, 17 Oct 2006 18:11:06 +0000 |
| Subject: | note 43690 deleted from language.types.string by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118641@lists.php.net to get a copy of this message | ||
Note Submitter: rtb27 at cam dot ac dot uk
----
If you want side effects to occur during variable substituion inside strings, the "?"
operator can help. For example:
<?php
$i = 0;
echo <<<LONGSTRING
one {${$i++ ? "i" : "i"}}
two {${$i++ ? "i" : "i"}}
three {${$i++ ? "i" : "i"}}
LONGSTRING;
?>
will print: "one 1 two 2 three 3"