Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/10/2012, 07:49
BrunoIV
 
Fecha de Ingreso: enero-2012
Mensajes: 20
Antigüedad: 12 años, 3 meses
Puntos: 0
Objetos PHP en ficheros

Buenas, estoy intentando hacer lo siguiente:

Index.php
Código:
<html>
	<head>
	
	</head>
	
	<body>
		<?php
			include("Persona.php");
			$p1=new Persona();
			$p1->iniciar('bruno');
			$p1->imprimir();
		?>
	</body>
</html>

Persona.php
Código:
class Persona {
	private $nombre;
	
	public function iniciar($nom) {
		$this->nombre=$nom;
	}		
	
	public function imprimir() {
		echo $this->nombre."<br/>";
	}
}

Sin embargo me muestra el código del objeto. ¿Hago algo mal?