Discussion:
Array + php
El Ale...
2013-12-14 00:01:59 UTC
Permalink
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?
m***@behnke.biz
2013-12-14 13:03:41 UTC
Permalink
Maybe ask in english? Bigger target audience....
Post by El Ale...
Gente una consulta bastante off topic. Quiero meter un array en una clase y
  <?
         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?
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ***@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2013-12-14 13:55:44 UTC
Permalink
Post by El Ale...
Gente una consulta bastante off topic. Quiero meter un array en una clase y
<?
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?
Missing a right parenthese:

syntax is:
$var = array();
$var = array(array());

You wrote:
$var = array(array(); !!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Shawn McKenzie
2013-12-14 16:56:41 UTC
Permalink
Post by El Ale...
Gente una consulta bastante off topic. Quiero meter un array en una clase y
<?
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());

Continue reading on narkive:
Loading...