Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2009, 23:33
Avatar de Highlander
Highlander
 
Fecha de Ingreso: junio-2006
Ubicación: Concepción, Chile
Mensajes: 475
Antigüedad: 20 años, 4 meses
Puntos: 4
Return multiples valores

Ok recien empiezo con esto, este codigo me funciona pero mi duda es una metodologia correcta para imprimir los datos?

Código PHP:
<?php

class Ingrediente
{
    var 
$nombre = null;
    var 
$fuente = null;
    var 
$energia = null;
    var 
$proteina = null;
    var 
$grasa_total = null;
    var 
$colesterol = null;
    var 
$hidratos_carbono = null;
    var 
$sodio = null;
    
    function 
introducirIngrediente($nombre, $fuente, $energia, $proteina, $grasa_total, $colesterol, $hidratos_carbono, $sodio)
    {
        
$this->nombre = $nombre;
        
$this->fuente = $fuente;
        
$this->energia = $energia;
        
$this->proteina = $proteina;
        
$this->grasatotal = $grasatotal;
        
$this->colesterol = $colesterol;
        
$this->hidratoscarbono = $hidratoscarbono;
        
$this->sodio = $sodio;
        
    }
    
    function 
mostrarIngrediente()
    {
        
$retorno = array($this->nombre, $this->fuente);
        return (
$retorno);
        
    } 
    
}

$ingrediente = new Ingrediente;
$ingrediente->introducirIngrediente('Azucar', 'USDA', '1', '2', '3' ,'4', '5', '6');
list (
$zero, $one) = $ingrediente->mostrarIngrediente();
echo 
$zero;
echo 
$one;


?>
__________________
Ingeniero (E) en Computación e Informática
The last man alone with god.