Jump to content

[SOLVED] sorting arrays


monk.e.boy

Recommended Posts

Hello,

 

  How would I go about sorting the following array?

 


$t= array();
$t[] = array( 'text 2', 1, 2 );
$t[] = array( 'text 4', 2, 1 );
$t[] = array( 'text 1', 1, 1 );
$t[] = array( 'text 5', 2, 2 );
$t[] = array( 'text 3', 1, 3 );

// sort and get:

$t[] = array( 'text 1', 1, 1 );
$t[] = array( 'text 2', 1, 2 );
$t[] = array( 'text 3', 1, 3 );
$t[] = array( 'text 4', 2, 1 );
$t[] = array( 'text 5', 2, 2 );

 

I guess this is like an SQL ORDER BY col1, col2

 

Anyone know if there is an easy way to do this in PHP?

 

cheers  :)

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/44759-solved-sorting-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.