views:

25

answers:

2

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?

+2  A: 

I think you'll find this topic useful;

Are PHP short tags acceptable to use?

Kemo
+3  A: 

Use <?php instead of <? he might not have short tags enabled.

Ivo Sabev
thanks. perfect.
arik-so