if ($sess_uid == $WallID) { // } else { Run Action }
Work but
if (!$sess_uid == $WallID) { Run Action }
Does not work. Why is this? I want the code to fire if both identifiers do not match.
It:
This is equivalent to this:
if ( (!$sess_uid) == ($WallID)) { Run Action }
While you want:
if (!($sess_uid == $WallID)) { Run Action }
!has a higher precedence than ==.
!
==
!a==b regarded as (!a) == b
!a==b
(!a) == b
You need !(a==b)which is equala != b
!(a==b)
a != b
You are using a unary operator! which only affects the value of $ sess_uid. So you are denying the value of $ sess_uid. What you are probably looking for is to use! = Instead.
if (!$sess_uid != $WallID){ Run Action }
if (!$sess_uid == $WallID) don't equals if ($sess_uid !== $WallID)
Source: https://habr.com/ru/post/1768405/More articles:How to create a link to rails with an AR verification message - ruby-on-railsCan I programmatically add a row to datagrid WPF? - wpfresize text area to fit fluid width layout using javascript - javascriptPerfect Enums in PHP - phpto choose window behavior in IE - jqueryhow to convert boost :: weak_ptr to boost :: shared_ptr - c ++Authentication on Web.py - Will this code be unsafe for production? - pythonUsing the Stop Tray C # - c #The maven dependency level is not working properly - maven-2How to write a C function in C # code - cAll Articles