Tijnema ! wrote:
On 4/16/07, Jochem Maas [EMAIL PROTECTED] wrote:
Richard Lynch wrote:
On Wed, April 11, 2007 9:00 pm, Jochem Maas wrote:
[PS - I've the pleasure of listening to a colleague do a manual
install
of Vista over an existing copy of XP and then get the really tricky
stuff
like
Richard Lynch wrote:
On Wed, April 11, 2007 9:00 pm, Jochem Maas wrote:
[PS - I've the pleasure of listening to a colleague do a manual
install
of Vista over an existing copy of XP and then get the really tricky
stuff
like the soundcard to work ... for the last week :-/]
Give them an
On 4/16/07, Jochem Maas [EMAIL PROTECTED] wrote:
Richard Lynch wrote:
On Wed, April 11, 2007 9:00 pm, Jochem Maas wrote:
[PS - I've the pleasure of listening to a colleague do a manual
install
of Vista over an existing copy of XP and then get the really tricky
stuff
like the soundcard to
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote:
http://php.net/array_flip followed up an unset, followed by another
array_flip, I guess...
What if you have an array like this:
Array
(
[0] = Array
(
[0] = 1
[1] = 2
[2] = 2
[3] = 2
Paul Novitski wrote:
At 4/10/2007 03:09 PM, M.Sokolewicz wrote:
Such a function is inherently a Bad Idea (tm). array-values are not
unique. Array keys are. So unless you want to emulate the way
array_flip works (bad idea (tm)), I'd say: leave it be.
Whoever owns that trademark has totally
On Wed, April 11, 2007 8:44 am, Tijnema ! wrote:
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote:
http://php.net/array_flip followed up an unset, followed by another
array_flip, I guess...
What if you have an array like this:
Array
(
[0] = Array
(
[0] = 1
On Wed, April 11, 2007 9:00 pm, Jochem Maas wrote:
[PS - I've the pleasure of listening to a colleague do a manual
install
of Vista over an existing copy of XP and then get the really tricky
stuff
like the soundcard to work ... for the last week :-/]
Give them an Ubuntu (or similar) CD and
Hi,
Is there currently a function that removes a key/value from an array?
I use this code right now:
function array_remove($array,$remove,$remove_value = true)
{
foreach($array as $key = $value) {
if($remove_value $value != $remove) {
http://php.net/unset
On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote:
Hi,
Is there currently a function that removes a key/value from an array?
I use this code right now:
function array_remove($array,$remove,$remove_value = true)
{
foreach($array as $key = $value) {
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote:
http://php.net/unset
That works when you know the key, but will that work when you only
know the value?
Tijnema
On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote:
Hi,
Is there currently a function that removes a key/value from an array?
While that is true, you need to know the key,
you could do something like this,
which I think is more efficient than your way...
foreach($array as $key = $value)
{
if ($value == $remove)
{
unset($array[$key]);
//if you know there is only one hit,
! [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 10, 2007 3:53 PM
To: [EMAIL PROTECTED]
Cc: PHP
Subject: Re: [PHP] Array remove function?
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote:
http://php.net/unset
That works when you know the key, but will that work when you only
know the value
Tijnema ! wrote:
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote:
http://php.net/unset
That works when you know the key, but will that work when you only
know the value?
Tijnema
Use array_search() and unset()?
Lori
On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote:
Hi,
Is there
OMG. Now that is the best idea. How simple. Guess I learned something new
today too! :)
-Original Message-
From: Lori Lay [mailto:[EMAIL PROTECTED]
Use array_search() and unset()?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Unset works, but if he's trying to do a search and remove in one function,
unset is a step removed from that criteria (missing the 'search' part).
Looking at the array functions, I see some potential.
# array_remove(array(1=2,2=3),2,true); // array (2=3)
// Keep all but where values = 2
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote:
OMG. Now that is the best idea. How simple. Guess I learned something new
today too! :)
-Original Message-
From: Lori Lay [mailto:[EMAIL PROTECTED]
Use array_search() and unset()?
Interesting, I didn't thought of that :)
But
Tijnema ! wrote:
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote:
OMG. Now that is the best idea. How simple. Guess I learned something
new
today too! :)
-Original Message-
From: Lori Lay [mailto:[EMAIL PROTECTED]
Use array_search() and unset()?
Interesting, I didn't thought
http://php.net/array_flip followed up an unset, followed by another
array_flip, I guess...
Why in the world you'd architect the array with a value when you need
to unset by value in the first place is beyond me, though...
On Tue, April 10, 2007 2:52 pm, Tijnema ! wrote:
On 4/10/07, Richard
Lori Lay wrote:
Tijnema ! wrote:
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote:
OMG. Now that is the best idea. How simple. Guess I learned something
new
today too! :)
-Original Message-
From: Lori Lay [mailto:[EMAIL PROTECTED]
Use array_search() and unset()?
Interesting,
On Tue, April 10, 2007 3:22 pm, Tijnema ! wrote:
On 4/10/07, Daevid Vincent [EMAIL PROTECTED] wrote:
OMG. Now that is the best idea. How simple. Guess I learned
something new
today too! :)
-Original Message-
From: Lori Lay [mailto:[EMAIL PROTECTED]
Use array_search() and
At 4/10/2007 03:09 PM, M.Sokolewicz wrote:
Such a function is inherently a Bad Idea (tm). array-values are not
unique. Array keys are. So unless you want to emulate the way
array_flip works (bad idea (tm)), I'd say: leave it be.
Whoever owns that trademark has totally got to be the
On Tue, April 10, 2007 5:39 pm, Paul Novitski wrote:
values. If both keys and values are unique, I'd consider (if only
briefly) maintaining two arrays, one a flipped version of the other,
so I could look up key/value pairs using either node.
I do this all the time for small/medium arrays.
22 matches
Mail list logo