Fwd: Re: [PHP] Remove value from array

2002-01-16 Thread [EMAIL PROTECTED]
I also just discovered how to check for these keys with no value as isset() will return false: "bar"); $arr["foo"] = NULL; print_r($arr); // you can see "foo" is still there if (array_key_exists("foo", $arr)) { echo("it's there!"); } ?> bvr. ===

Re: [PHP] Remove value from array

2002-01-16 Thread Erik Price
This is a good one I just learned last week -- unset the variable. That is, unset($Arr[2]); or unset($Arr['cyanide']); from what I understand, the discovery of this easy way to do this was accidental. See the second annotation of "array_splice()" in the PHP manual here for the details:

Re: [PHP] Remove value from array

2001-06-26 Thread elias
array_splice() is the best! thanks for the hint. "Philip Olson" <[EMAIL PROTECTED]> wrote in message Pine.BSF.4.10.10106252001180.61091-10@localhost">news:Pine.BSF.4.10.10106252001180.61091-10@localhost... > Here's an example : > > > $foo = array('a','b','c'); > > unset($foo[1]

RE: [PHP] Remove value from array

2001-06-25 Thread Kristian Duske
> http://php.net/manual/en/language.types.array.php > there is written: > "To change a certain value, just assign a new value to it. If you want to > remove a key/value pair, you need to unset() it." Damn, I looked for that and didn't find it =). Anyway, thanks for the heads up. I was pretty sure

RE: [PHP] Remove value from array

2001-06-25 Thread mailing_list
> > Hello, > > how can I complete remove an item out of an array ? > > I tried unset() as well as setting the value to null. > > > > Both result in the value being null but not the item being deleted. > > As far as I know, this is not possible. You can, however, create a new > array > and copy al

Re: [PHP] Remove value from array

2001-06-25 Thread Philip Olson
Here's an example : a [2] => c $bar = array('a','b','c'); $piece = array_splice ($bar, 1 ,1); print_r($piece); // [0] => b print_r($bar);// [0] => a [1] => c ?> http://www.php.net/manual/function.array-splice.php regards, philip On Mon, 25 Jun 2001, Bret R.

RE: [PHP] Remove value from array

2001-06-25 Thread Kristian Duske
> Hello, > how can I complete remove an item out of an array ? > I tried unset() as well as setting the value to null. > > Both result in the value being null but not the item being deleted. As far as I know, this is not possible. You can, however, create a new array and copy all values except th