mercredi 7 octobre 2020

PHP: Not equal to not taking effect

I am having issues with a simple not equal to operator that's not taking effect for some reason.

Made a field backend which returns a specific user ID whilte get_current_user_id(); also returns user ID. I have tried echo bot $user and $current where they both returns user ID 9 as expected on my test user.

Since they $current and $user is returning same user ID the content should not be shown but for some reason it does. I am using != as a PHP operator for "Not equal to" - What am I missing ?? See code below:

$user = get_field("user");
$current = get_current_user_id();

if( in_array( "bestyrelsevalg", $row['bestyrelse'] ) && $user != $current )

Aucun commentaire:

Enregistrer un commentaire