Ask a Question related to PHP Development, Design and Development.
-
JiøîÆèî eË #1
sorting multi-array
hello,
i have got a problem, tehere is an array:
$x = array(
array(15,55,array(1,2,3),3,5,array(1,2,5)),
array(25,55,array(1,2,3),3,5,array(1,2,5)),
array(5,55,array(1,2,3),3,5,array(1,2,5))
);
and I need to sort this arraybz first item of sub-arrays (x[0][0],
$x[1][0], $x[2][0]). this is the correct result:
$x = array(
array(5,55,array(1,2,3),3,5,array(1,2,5)),
array(15,55,array(1,2,3),3,5,array(1,2,5)),
array(25,55,array(1,2,3),3,5,array(1,2,5))
);
some idea how sort this multidimensional array? thank you for your
reply.
jiøí nìmec, ICQ: 114651500
[url]www.menea.cz[/url] - www stránky a aplikace
JiøîÆèî eË Guest
-
Sorting array vs sorting paginated array
....pulling in a long list of photos in a gallery, and I have a sort function working within the pages of data fine. I need to bring it back out of... -
Converting an XML Array to a multi-level array
I have an array assigned to a data grid such as: private var myIngredients:Array = new Array( <item ln1="Plain" sn="plain" ln2="(3 cups)... -
Array Sorting
Hey everyone, I figured someone out there must have come across the need for this before, so rather than continue banging my head against the... -
Sorting a Multidimensional Array
I have an array like this: $events = array( array( '2003-07-01', 'Event Title 1', '1' //ID Number (not unique) ), array( '2003-07-02', -
Sorting multi-page datagrid
I have a datagrid with many pages. I need to sort the data in a specific page of the grid. The default behavior sorts the whole dataview, causing a... -
Marek Kilimajer #2
Re: [PHP] sorting multi-array
[url]www.php.net/usort[/url] - slight modification of the example (hint: add [0] to
$a and $b).
Jiøí Nìmec wrote:
> hello,
>
> i have got a problem, tehere is an array:
>
> $x = array(
> array(15,55,array(1,2,3),3,5,array(1,2,5)),
> array(25,55,array(1,2,3),3,5,array(1,2,5)),
> array(5,55,array(1,2,3),3,5,array(1,2,5))
> );
>
> and I need to sort this arraybz first item of sub-arrays (x[0][0],
> $x[1][0], $x[2][0]). this is the correct result:
>
> $x = array(
> array(5,55,array(1,2,3),3,5,array(1,2,5)),
> array(15,55,array(1,2,3),3,5,array(1,2,5)),
> array(25,55,array(1,2,3),3,5,array(1,2,5))
> );
>
> some idea how sort this multidimensional array? thank you for your
> reply.
>
> jiøí nìmec, ICQ: 114651500
> [url]www.menea.cz[/url] - www stránky a aplikace
>
>Marek Kilimajer Guest
-
Sven #3
Re: sorting multi-array
hi,
try usort();
ciao SVEN
JiøîÆèî eË wrote:> hello,
>
> i have got a problem, tehere is an array:
>
> $x = array(
> array(15,55,array(1,2,3),3,5,array(1,2,5)),
> array(25,55,array(1,2,3),3,5,array(1,2,5)),
> array(5,55,array(1,2,3),3,5,array(1,2,5))
> );
>
> and I need to sort this arraybz first item of sub-arrays (x[0][0],
> $x[1][0], $x[2][0]). this is the correct result:
>
> $x = array(
> array(5,55,array(1,2,3),3,5,array(1,2,5)),
> array(15,55,array(1,2,3),3,5,array(1,2,5)),
> array(25,55,array(1,2,3),3,5,array(1,2,5))
> );
>
> some idea how sort this multidimensional array? thank you for your
> reply.
>
> jiøí nìmec, ICQ: 114651500
> [url]www.menea.cz[/url] - www stránky a aplikace
Sven Guest
-
Curt Zirzow #4
Re: [PHP] command line or http browser?
* Thus wrote ermelir (ermelir@ifrance.com):
This is a good point. I'm not aware of any other names, although I> Hi list,
>
> I search to detect if a script is call from command line or if the call from
> a client http browser.
> for doing that, I test if:
> php_sapi_name()=='cli'
> which returns TRUE if script calls from command line; this work fine with
> PHP 4.2, but with PHP 5 php_sapi_name() returns cgi-fcgi
> so, I would know if with others php version there is others returns values?
> and if there is another way to detect if script is call from command line?
> thanks in advance for yours answers
have to admit i wan't aware of the sapi_name function either.. :)
There aught to be a better method of detecting whether you are in
cli mode or module mode. If this is the only way to determain it I
would make a suggestion to the php developers to have a way to
detect what mode your in. Detecting by a string value is very poor
method of doing it.
Ok, now after reading the docs, I see why its a string.... Some one
came up with a list of names, I have no clue where he got it his
reference tells me nothing.
- aolserver
- activescript
- apache
- cgi-fcgi
- cgi
- isapi
- nsapi
- phttpd
- roxen
- java_servlet
- thttpd
- pi3web
- apache2filter
- caudium
- apache2handler
- tux
- webjames
- cli
- embed
- milter
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Curt Zirzow Guest
-
Ermelir #5
Re: [PHP] command line or http browser?
thanks for your answer and sorry for my poor english ;)
in the list of returns values, there somes I can't determine if command line
or server values
* isapi
* nsapi
* embed
* milter
* activescript
* java_servlet
do you know?
thanks for your help
----- Original Message -----
From: "Curt Zirzow" <curt@zirzow.dyndns.org>
To: <php-general@lists.php.net>
Sent: Thursday, July 24, 2003 6:22 PM
Subject: Re: [PHP] command line or http browser?
from> * Thus wrote ermelir (ermelir@ifrance.com):> > Hi list,
> >
> > I search to detect if a script is call from command line or if the callwith> > a client http browser.
> > for doing that, I test if:
> > php_sapi_name()=='cli'
> > which returns TRUE if script calls from command line; this work finevalues?> > PHP 4.2, but with PHP 5 php_sapi_name() returns cgi-fcgi
> > so, I would know if with others php version there is others returnsline?> > and if there is another way to detect if script is call from command__________________________________________________ ___________________>> > thanks in advance for yours answers
> This is a good point. I'm not aware of any other names, although I
> have to admit i wan't aware of the sapi_name function either.. :)
>
> There aught to be a better method of detecting whether you are in
> cli mode or module mode. If this is the only way to determain it I
> would make a suggestion to the php developers to have a way to
> detect what mode your in. Detecting by a string value is very poor
> method of doing it.
>
> Ok, now after reading the docs, I see why its a string.... Some one
> came up with a list of names, I have no clue where he got it his
> reference tells me nothing.
>
> - aolserver
> - activescript
> - apache
> - cgi-fcgi
> - cgi
> - isapi
> - nsapi
> - phttpd
> - roxen
> - java_servlet
> - thttpd
> - pi3web
> - apache2filter
> - caudium
> - apache2handler
> - tux
> - webjames
> - cli
> - embed
> - milter
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> __________________________________________________ ___________________
> Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
> http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France
Ermelir Guest
-
Curt Zirzow #6
Re: [PHP] command line or http browser?
* Thus wrote ermelir (ermelir@ifrance.com):
IIS sapi> thanks for your answer and sorry for my poor english ;)
> in the list of returns values, there somes I can't determine if command line
> or server values
> * isapi
Netscape sapi> * nsapi
I believe these are all server related not sure though.> * embed
> * milter
> * activescript
> * java_servlet
You're welcome.> do you know?
> thanks for your help
>
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Curt Zirzow Guest
-
Marek Kilimajer #7
Re: [PHP] command line or http browser?
My uneducated guess is you are running cgi version of php binary, which
is different from cli version.
ermelir wrote:
> Hi list,
>
> I search to detect if a script is call from command line or if the callfrom
> a client http browser.
> for doing that, I test if:
> php_sapi_name()=='cli'
> which returns TRUE if script calls from command line; this work fine with
> PHP 4.2, but with PHP 5 php_sapi_name() returns cgi-fcgi
> so, I would know if with others php version there is others returns values?
> and if there is another way to detect if script is call from command line?
> thanks in advance for yours answers
> best regards
>
>
>
> __________________________________________________ ___________________
> Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
> [url]http://www.ifrance.com/_reloc/m[/url] la 1ère messagerie instantanée de France
>
>Marek Kilimajer Guest



Reply With Quote

