Please look at the example code below, when I run it, the defined part is nottranslated in the header function call, is there a special way to do the syntax or is this exact method not possible?
<?PHP
session_start();
define('SITE_URL', 'http://testsddf.com');
$_SESSION['user_role'] = 0;
//if a user is not active, redirect to verification/suspended page
if($_SESSION['user_role'] == 0){
header('Location: SITE_URL');
}
?>
You cannot do something like this :
A constant is not interpolated, inside of a string : it’s not a variable (and you are using single-quote string, so it wouldn’t work with a variable either, here)
You have to use string concatenation, in this situation :
And, just to put a link to the manual as a reference, you can take a look at Variable parsing : there is nothing there about constants — even if that’s unfortunate.