Hi,
I am just screwing around and getting used to arrays with a foreach thanks
to Michael,Jan and Evan from this list and have run into problems.
My requirment is pretty simple (code is below too)
1)unset all the sessions that might have been set with reference to the
hardcoded array ($vars)
2)if
Can someone correct me on this if i'm wrong...
try (meaning, I think that $vars as $keys will put the value into $key,
not the key itself):
foreach ($vars as $key=$value) // clear all previous sessions
{
if(isset($_SESSION['$key']))
{
unset($_SESSION['$key']);
}
}
Ryan A wrote:
Hi,
I
oh, don't forget, '$key' will not get evaluated. $key will.
John Manko wrote:
Can someone correct me on this if i'm wrong...
try (meaning, I think that $vars as $keys will put the value into
$key, not the key itself):
foreach ($vars as $key=$value) // clear all previous sessions
{
* Thus wrote John Manko ([EMAIL PROTECTED]):
Can someone correct me on this if i'm wrong...
try (meaning, I think that $vars as $keys will put the value into $key,
not the key itself):
foreach ($vars as $key=$value) // clear all previous sessions
{
if(isset($_SESSION['$key']))
{
John Manko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Can someone correct me on this if i'm wrong...
try (meaning, I think that $vars as $keys will put the value into $key,
not the key itself):
foreach ($vars as $key=$value) // clear all previous sessions
{
From: Ryan A [EMAIL PROTECTED]
I am just screwing around and getting used to arrays with a foreach
thanks
to Michael,Jan and Evan from this list and have run into problems.
My requirment is pretty simple (code is below too)
1)unset all the sessions that might have been set with reference to
* Thus wrote Ryan A ([EMAIL PROTECTED]):
foreach ($vars as $key) // clear all previous sessions
{
if(isset($_SESSION['$key']))
{
unset($_SESSION['$key']);
}
}
echo done1; //just checking program execution
No need to loop here, you can use an else statment in the next
loop. And
7 matches
Mail list logo