I would rather teach a man how to fish than give him
his supper on a silver platter.
Write his code and you can reduce his frustration for a day, but
teach him to program and you'll frustrate him for life.
tedd
--
---
[snip]
That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to count() - which gives no hint as to
how to sort the list, which is after all what the OP's trying to do.
ObSuggestion:
function byLength($a, $b)
{
return sizeof($a) - sizeof($b);
}
us
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> The array sorting suggestions you provide will not sort based on the
> number of items in each array, which is what the OP wanted.
That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to coun
[snip]
If you say so. In that case, jblanchard, I apologize for my outburst.
[/snip]
Apology accepted. Look, several of us have been on this list for years
and have helped several others through their issues. Mailing lists like
this (try a C++ newsgroup for example) are much more merciless than so
Jeremy Privett wrote:
[EMAIL PROTECTED] wrote:
[snip]
How can I sort a 2 dimensional array by number of elements?
[/snip]
Start by RTFM http://www.php.net/manual/en/function.count.php
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turn
Saline Erik wrote:
Sometimes I just need a point in the right direction. So RTFM is not
so bad.
Erik
If you say so. In that case, jblanchard, I apologize for my outburst.
--
Jeremy Privett
Director of Product Development
Zend Certified Engineer
Completely Unique
[EMAIL PROTECTED]
Phone:
[EMAIL PROTECTED] wrote:
[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's no one here willing
to help new people more than throwing them "RTFM" responses.
[/snip]
Are you new here? I would rather teach a man how to fi
Sometimes I just need a point in the right direction. So RTFM is not
so bad.
Erik
On Feb 28, 2006, at 11:26 AM, <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> wrote:
[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's
[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's no one here willing
to help new people more than throwing them "RTFM" responses.
[/snip]
Are you new here? I would rather teach a man how to fish than give him
his supper
[EMAIL PROTECTED] wrote:
[snip]
How can I sort a 2 dimensional array by number of elements?
[/snip]
Start by RTFM http://www.php.net/manual/en/function.count.php
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's
[snip]
How can I sort a 2 dimensional array by number of elements?
[/snip]
Start by RTFM http://www.php.net/manual/en/function.count.php
Thanks for the example using array_multisort. I'd been wondering how I
could use that function to do what I want. It looks like it's more flexible
in the long run, but I was able to use Paul's recommendation to do what I
want. Here's the code I ended up using:
function cmp ($a, $b) {
return
Sorry for the empty reply (miss slide of the finger on my touch pad).
You can use array_multisort(); The code would look something like
this, remember, this is untested code so be warned before any flaming
is done:
//CODE
//You need to restructure your array like this:
$menu["ID"][1] = 5;
$menu["T
On Fri, 1 Oct 2004 22:44:50 -0400, Paul Bissex <[EMAIL PROTECTED]> wrote:
> On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> > Any ideas on how I could sort this array by Title?
> >
> > $menu[1]["ID"] = 5;
> >
> > $menu[1]["Title"] = "Test 1";
> >
> > $menu[2]["ID"] = 3;
> >
On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> Any ideas on how I could sort this array by Title?
>
> $menu[1]["ID"] = 5;
>
> $menu[1]["Title"] = "Test 1";
>
> $menu[2]["ID"] = 3;
>
> $menu[2]["Title"] = "Test 4";
uasort() is what you need here.
Also see the usort()
15 matches
Mail list logo