Skip to content
Advertisement

expecting statement -php syntax | if-else

JavaScript

I get critical error.phpstorms says that expecting statements.I couldnt find a solution

Advertisement

Answer

You cannot “interrupt” the PHP code after the closing { of the if and before the else keyword.

Cleaned up version:

JavaScript

To avoid such errors, try learning and following a coding standard, e.g. PSR-12.

Since you are working with WordPress, here is WP’s coding standard for PHP: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement