I'm not sure if this is intended behaviour or not, but I can see that is
might be.  Just thought I would bounce this to see what people think about
it:

<?php
 if (false)
  ?>Hello<?php
 else
  echo "Hi";

 echo " World\n";
?>

This returns a parse error due to the fact there is no brackets around the
first part of the if statement.  It seems that because the next line after
the if is not php, then it terminates the if at the closing of the php tag.

But if you do this:

<?php
 if (false)
  ?>Hello<?php
?>

or

<?php
 if (true)
  ?>Hello<?php
?>

The word "Hello" is always output for the same reason.

I can understand why to some extent in the way that is behaves, but it
depends on your point of view as to what "statement" (as per the manual)
actually means.  Why can the bracketed version of if conditionaly display
html, yet the unbracketed lazy man version cant?

Any ideas as to whether or not this is supposed to happen like this or not?

Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to