On Thu, 26 Oct 2006 01:04:25 -0700, Paul Novitski wrote:
> It's so interesting that some details bug some people and others bug
> others. In an expression such as this:
>
> echo '<option value="' . $day . '"' . $selected . '>' . $day
> . '</option>';
>
> ...I count eight transitions (instances of switching between PHP
> syntax and output text) -- one each time you open or close a quote --
> compared to just two transitions (the opening & closing labels) for
> the comparable heredoc statement:
>
> print <<< hdDay
> <option value="$day"$sSelected>$day</option>
>
> hdDay;
At 10/28/2006 04:28 AM, Nisse Engström wrote:
That's funny. I count eight transitions in both
examples. The difference in the second example is
that the transition switches have changed from
open/closing quote to '$'/not-a-variable-character.
Yes, from the point of view of the PHP parser, a
transition is made each time you encounter an
embedded variable requiring evaluation and each
time you return to the quoted expression that
doesn't require that same kind of evaluation.
What I was referring to were transitions of PHP
syntactical punctuation that fragment the
expression from the human point of view. I
personally find the heredoc expression much
easier to read, proofread, and maintain because
it appears to be all one simple, unbroken expression.
Regards,
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php