This kind of error usually occurs when there are one or more spaces before “< ?php†and after “?>â€
i.e.
rather than
< ?php
it reads like
or
?>
becomes
?>
So next time you face such error, just check whether there is any space at the start or end of php code.

