What causes 'unexpected t_exit' in php?
Example:
if ($x > 10)
exit();
echo "Hello";
You might encounter this error when using the 'exit' function without braces in an 'if' statement, and having a statement after it.
Solution:Use braces for the 'if' condition or ensure correct structure.
if ($x > 10) {
exit();
}
echo "Hello";