These statements are not completely equivalent.
if(!session_id()){} means if(session_id() != TRUE){} , so the function session_id() can return 0 , FALSE , '' , NULL .
and if(session_id()===""){} checks if session_id() returns an empty STRING, so the only option for which the if returns TRUE is '' .
From the PHP manual about session_id() :
session_id () returns the session identifier for the current session or an empty string ("") if the current session is absent (current session is absent id exists).
So, it is preferable to use the 1st method.
source share