session_register() function is generating warnings. Therefore, instead of using:
$test = 'Here';
It is better :
$_SESSION['test'] = 'Here';
(PHP 4, PHP 5 < 5.4.0)
session_is_registered — Descobre se uma variável global está registrada numa sessão
Verifica se há uma variável global é registrada na sessão.
O nome da variável.
TRUE se há uma
variável global com o nome
name registrado na
FALSE caso contrário.
For those who have an older application which uses the session_is_registered..and you want to use that in php5.4
You can just define the function if required
May be add the checks to ensure function is not already existing..
Just to elaborate for those who may be having some problems.
If you're using a newer version of PHP that comes with the register globals directive set to "off", you should heed the caution at the top of these notes. It's easier anyway.
Instead of using session_register(...) , simply use somethig like:
//must always start the session first
//in place of session register(..) use...like someone said above
$_SESSION['VARNAME'] = $something // or "something";
/* then on the same page or subsequent pages where you want check for the session use something like....
and on another page where the session hasn't been started you have to call session_start(); first, if the session has already been started you don't need to call it again */
//instead of session_is_registered();
print("What you want if the session var is set");
print("What you want if the sessions variable is not set");
I hope this helps someone! If you want to learn more about $_SESSION and/or it's related "superglobals" try
When using PHP 4.2.0 even on the same page where you registered the variable with:
if you try to see if the variable is set and do not assign it a value before, the function used in the previous comment will give the same output.
This may show that the variable is declared and will not be set until some value is give assign to it.
I think that this way will give the option to register all the variables used for sure on the process on the first page and using them as the time comes.