View Single Post
Old 08-25-2009, 06:26 PM   #6 (permalink)
hello-world
The Contributor
 
hello-world's Avatar
 
Join Date: Feb 2009
Posts: 73
Thanks: 30
hello-world is on a distinguished road
Default

I think you can you this function
PHP Code:
array_multisort() 
I read once in a book.
I see if could solve your next problem.

PHP Code:
$shop = array( array( 'team-name' => "rose"
                      
'played' => 64,
                      
'poinst' => 1,
                      
'won' => 6,
                      
'draw' => 4,
                      
'lost' => 2,
                      
'for' =>2,
                       
                    ),
               array(
'team-name' => "rose"
                      
'played' => 25,
                      
'poinst' => 5,
                      
'won' => 7,
                      
'draw' => 6,
                      
'lost' => 4,
                      
'for' =>2,
                    ),
               array(
'team-name' => "rose"
                      
'played' => 125,
                      
'poinst' => 15,
                      
'won' => 1,
                      
'draw' => 5,
                      
'lost' => 25,
                      
'for' =>2,
                    )
             );
             foreach(
$shop as $key => $value){
                 echo 
"<pre>";
                 echo 
$key; echo "=>";
                 foreach (
$value as $key => $value){
                     echo 
$key ."=>".$value;
                         echo 
"<br>";
                 }    
                 
             }
             
             echo 
"<hr>";

              foreach (
$shop as $key => $row) {
                
$won[$key]  = $row['lost'];
                
$draw[$key] = $row['draw'];
        }

   
array_multisort($won,$draw $shop);
     
    foreach(
$shop as $key => $value){
                 
                 echo 
$key; echo "=>";
                 foreach (
$value as $key => $value){
                     echo 
$key ."=>".$value;
                         echo 
"<br>";
                 }    
                 
             } 
hello-world is offline  
Reply With Quote