vendredi 23 novembre 2018

This PHP if statement should work, but doesn't

I have a problem with what should be a really simple PHP if statement. Having looked at it from all angles and googled a long time with no success, I reach out for some help here. I am sure there is just a simple thing I am missing.

I have tried two ways that produce two separate errors.

First one:

if ( ( $i === 5 ) || ( $i == $posts_amount ) ) { echo '</section>'; }

This produces the following error: "Call to undefined function ()"

The second way, which is my preferred way:

if ( $i === 5 || $i == $posts_amount ) { echo '</section>'; }

This produces the following error: "syntax error, unexpected '$i' (T_VARIABLE)"

Aucun commentaire:

Enregistrer un commentaire