Re: Extracting multi dimensional array value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 4 May 2015 at 10:21 German Geek <geek.de@xxxxxxxxx> wrote:

> Yes I was endorsing min and max.
>

The OP wasn't clear as to whether they wanted the key or the value of the
earliest date. If they want the key(s) then min() won't work.

And regarding algorithm speed: http://dev.3ft9.com/php/min-date.php

The difference between sorting and foreach is minimal, so it probably
doesn't matter which is used as far as performance goes. In my experience,
unless you're dealing with Google-sized usage or high-throughput pipelines
this sort of optimisation is a waste of developer time, especially when you
compare this time difference to the time PHP will spend waiting for
databases to do their thing.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


> On Mon, 4 May 2015 10:45 am Shawn McKenzie <shawn@xxxxxxxxxxxxx> wrote:
>
> > How about min()?  Or for the newest max().
> >
> > On Fri, May 1, 2015 at 9:37 PM, Ron Piggott <
> > ron.piggott@xxxxxxxxxxxxxxxxxx>
> > wrote:
> >
> > >
> > > I have the following array:
> > >
> > > Array
> > > (
> > >     [es-PR] => 2014-11-04 08:22:07
> > >     [en-US] => 2009-04-05 09:00:00
> > >     [es-MX] => 2014-11-08 02:25:40
> > > )
> > >
> > > How can I extract the oldest date from it?  The language ISO order is
> > > going to change randomly.
> > >
> > > Ron
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux