PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Shendemiar
Forum Contributor
Posts: 404 Joined: Thu Jan 08, 2004 8:28 am
Post
by Shendemiar » Mon Dec 11, 2006 8:52 pm
Code: Select all
$A = array (
'Some' => 'zzzz',
'Thing' => 'SSSS',
'B' =>
array (
'1:1:1' => 0,
'2:2:2' => 0,
'3:3:3' => 0,
How come
Code: Select all
$R = $_GET['F'] (='2:2:2')
unset($A['B'][$R]);
var_export $A
...
'1:1:1' => 0,
'3:3:3' => 0,
'' => 0,
Last edited by
Shendemiar on Mon Dec 11, 2006 9:20 pm, edited 1 time in total.
Shendemiar
Forum Contributor
Posts: 404 Joined: Thu Jan 08, 2004 8:28 am
Post
by Shendemiar » Mon Dec 11, 2006 9:19 pm
Using array pop i can get rid of it, but its weird.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Dec 11, 2006 11:06 pm
I have no idea what problem you are having because you haven't explained anything. Please do so.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Dec 12, 2006 1:21 am
I cannot reproduce the "error".
Code: Select all
<?php
$A = array (
'Some' => 'zzzz',
'Thing' => 'SSSS',
'B' =>array (
'1:1:1' => 0,
'2:2:2' => 0,
'3:3:3' => 0
)
);
$R = '2:2:2';
unset($A['B'][$R]);
var_export($A);prints
Code: Select all
array (
'Some' => 'zzzz',
'Thing' => 'SSSS',
'B' =>
array (
'1:1:1' => 0,
'3:3:3' => 0,
),
)
Ind007
Forum Newbie
Posts: 14 Joined: Fri Dec 01, 2006 12:39 am
Location: India
Post
by Ind007 » Tue Dec 12, 2006 1:33 am
To Shendemiar
I think, we cannot expect unset() to make the key value somthing like space or null