PHP text output in clauses

Posted by arik-so on Stack Overflow See other posts from Stack Overflow or by arik-so
Published on 2010-04-08T14:11:43Z Indexed on 2010/04/08 14:13 UTC
Read the original article Hit count: 453

Filed under:
|
|
|
|

Hello. I am working on a PHP project. There, I often use following syntax to output text in a cluase:

if($boolean){

?>
output text
<?

}else{

?>
alternative
<?

}

On my computer, this works perfectly well. I use XAMPP foer Mac OS X. But when I send the files to my coworker, these outputs often do not work and the compiler complains about having reached an unexpected $end of file. This occurs especially often when there is a tag in the output. We have to replace the means of output with echo.

What's the reason for this strange behavior of the compiler? Is the above-mention syntax of outputting text wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about clause