Syntax error on closing brace after opening a php tag -


i'm getting trouble function looks pretty this:

<?php  function my_function() {      if(!empty($variable)) {         //do stuff     }     else {         ?>show message<?php      } } ?> 

the problem i'm getting parse error:

parse error: syntax error, unexpected ‘}’ in /www/bla/bla/bla.php on line 8

i know fact i'm not missing or have '}' brace because code works fine on local server , i've run validator make sure syntax correct, however, when port code online server, error.

i believe has php installation not supporting closing , reopening of php tags between condition i'm not sure how go fixing it.

i know echo 'message'; instead, not place script uses kind of syntax display messages, fixing here mean i'd error on line, , another.

thanks.

as stands piece of code runs fine on php 5.2.14.

when pasted in code sure pasted line as-is?:

?>show message<?php 

the thing can think of code on server using short open tag <? short_open_tag turned off in server's php.ini, example :

?>show message<? 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -