Parse error: syntax error, unexpected ';'

I am migrating my site from PHP 4 to 5

I keep getting this error on version 5 server:

Parse error: syntax error, unexpected ';' in / var / www / vhosts / ****. php on line 1688

I, when I check the code, something like this:

<?=#something here being commented out?>

      

This worked fine in v4, but now it generated an error. I don't really understand the error because there is no in the whole line ;

?

I can just delete the line, but I'm wondering why is this error happening in the first place, and if there is anything else I can do other than hunting down every case of this?

Thanks!!

+2


a source to share


3 answers


It:

<?=#something here being commented out?>

      

Translated as follows:



<?php echo /*something here being commented out*/; ?>

      

You just need to correct the syntax I am assuming.

+6


a source


There is an option that allows you <?

to shorten for <?php

- make sure it's on.



+1


a source


unexpected ';' indicates that he was not expecting the command to end. In your code, you have a shorthand open tag. You basically tell it to echo and not pass an argument to it when you do:

<?= //comment ?>

      

If you shorten this value to:

<?php //echo 'something'; ?>

      

You would be safe.

0


a source







All Articles