03-30-2008, 04:46 AM
|
#4 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
PHP Code:
<?php
$_SESSION['user'] = "Orc"; $_SESSION['a'] = "this is a test"; # merely a test function DeleteElement($input, $key) {
if (array_key_exists($key,$input)) {
unset($_SESSION[$key]); $tplArray = array('tpl'); $new = array_fill_keys($tplArray,'my_templates'); $_SESSION['tpl'] = $new['tpl']; print_r($_SESSION); # You can take this out if you want } }
DeleteElement($_SESSION, 'user');
echo $_SESSION['tpl']; # Which gives you My_templates
?>
Okay, I came up with this function that deletes an element by key in the Array, this can definitely be improved cause its only adding a new key and val by what you said 'tpl' soo..
Try this, I don't even know if I did exactly what you requested.
Which gave me this:
PHP Code:
Array ( [a] => this is test [tpl] => my_templates ) my_templates
Now I understand $_SESSION is an associative array, so fiddle with it.
__________________
VillageIdiot can have my babbies ;d
|
|
|
|