Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/12/2008, 09:50
lanceusp
 
Fecha de Ingreso: mayo-2005
Ubicación: Muy lejos de aquí
Mensajes: 367
Antigüedad: 19 años
Puntos: 0
Respuesta: Ordenar un array

El constructor de una clase lleva el mismo nombre que ésta o en PHP5 __construct.

Te quedaría así

Código PHP:
class ejercicio {
  
  var 
$matriz;  

   function 
ejercicio ($matriz) {
      
$this->matriz $matriz;
  }

function 
ordenar_matriz() 
  { 
      
arsort($this->matriz); 
             
      echo 
"<table border=1 ALIGN=center CELLPACING=7> "
         
      for (
$i=0;$i<sizeof($this->matriz)-1;$i++)  
    { 
    echo 

        <tr> 
            <td ALIGN=center>"
.$this->matriz[$i][0]."</td> 
            <td ALIGN=right>"
.$this->matriz[$i][1]."</td> 
            <td ALIGN=right>"
.$this->matriz[$i][2]."</td> 
        </tr> "

    } 
        echo 
"</table> "
  } 


__________________
Saludos!