RE: [PHP] unset($array[value]) does not work?

2002-06-12 Thread Lazor, Ed

It is working.

The last two tests you were running weren't actually the same, which was
confusing your testing results.  I've altered the code a little for ease of
testing.  It's included below.

-Original Message-
You will see that $unserialized['foo'] still exists! Can anyone explain me
what I'm doing wrong?

--

 "bar",
"wom" => "bat"
);

echo $array["foo"] . "";
echo $array["wom"] . "";

$serialized = serialize($array);

echo $serialized . "";

$unserialized = unserialize($serialized);

echo $unserialized["foo"] . "";
echo $unserialized["wom"] . "";

echo "";

$keys = array_keys ($unserialized);

echo $keys[0] . "";
echo $keys[1] . "";

echo "";

if (key_exists("foo", $unserialized)) { echo "foo exists!"; }
if (key_exists("wom", $unserialized)) { echo "wom exists!"; }

echo "";
unset ($unserialized['foo']);

if (key_exists("foo", $unserialized)) { echo "foo exists!"; }
if (key_exists("wom", $unserialized)) { echo "wom exists!"; }

?>
 

This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message.  If you have received this message in error, please immediately
advise the sender by reply email and delete the message.  Thank you very
much.   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] unset($array[value]) does not work?

2002-06-12 Thread Leon Mergen

Hello,

I am currently testing out some things with removing elements from arrays,
and I find it strange that the following statement does not work for me:

unset($array['element'])

I wrote a little test script, you can see the source at
http://www.antrophia.com/test.txt and the executable at
http://www.antrophia.com/test.php ... Now, if you look at the last part:

unset ($unserialized['foo']);
if (key_exists("foo", $unserialized)) { echo "foo exists!\n"; }
if (key_exists("wom", $unserialized)) { echo "wom exists!\n\n"; }

You will see that $unserialized['foo'] still exists! Can anyone explain me
what I'm doing wrong?

Thanks in advance,

Leon Mergen



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php