Re: Fwd: Array + php
| From: | Shawn McKenzie | Date: | Sat, 14 Dec 2013 16:56:41 +0000 |
| Subject: | Re: Fwd: Array + php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322574@lists.php.net to get a copy of this message | ||
2013/12/13 El Ale... <alexissaucedo@gmail.com>
> Gente una consulta bastante off topic. Quiero meter un array en una clase y
> no se como hacerlo se me ocurrio algo asi:
>
> <?
> class Listado_Completo
> {
> protected $datosArray =array(0=> array( "juan", "perez",
> "2352562"),
> 1=>array("Marina", "Zafon", "32568952"),
> 2=> array("fulano", "de tal", "32149856");
>
>
> public function Get_Listado_Completo(){
> return $this->datosArray;
> }
>
>
> }
> ?>
>
> Pero no puedo llamar a ninguno, alguien sabe como hacerlo?
>
The parse error tells you the line. You are missing a closing ) for your
array definition. Fix that and all works. But might also need a full
<?php instead of just <?.
class Listado_Completo
{
protected $datosArray =array(0=> array( "juan", "perez",
"2352562"),
1=>array("Marina", "Zafon", "32568952"),
2=> array("fulano", "de tal", "32149856"));
public function Get_Listado_Completo(){
return $this->datosArray;
}
}
$o = new Listado_Completo;
print_r( $o->Get_Listado_Completo());