Why do i get 'unexpected t_variable' in php?

Example:

$varname
echo $varname;

This error typically means that you forgot a semicolon at the end of a statement.

Solution:

Add the missing semicolon to fix the error.


$varname;
echo $varname;

Beginner's Guide to PHP