Forum » Programiranje » [PHP] Razred - nejasnost
[PHP] Razred - nejasnost
Simko ::
class Test
{
var $member1;
var $member2;
function Test()
{
$this->$member1 = 1;
$this->$member2 = array(1,2,3);
}
function WriteMe()
{
print_r($this->$member1);
print_r($this->$member2);
}
}
$test = new Test();
$test->WriteMe();
Zakaj mi ta koda izpiše dve polji in ne enkrat 1 in enkrat polje?
{
var $member1;
var $member2;
function Test()
{
$this->$member1 = 1;
$this->$member2 = array(1,2,3);
}
function WriteMe()
{
print_r($this->$member1);
print_r($this->$member2);
}
}
$test = new Test();
$test->WriteMe();
Zakaj mi ta koda izpiše dve polji in ne enkrat 1 in enkrat polje?
Robi182 ::
class Test
{
var $member1;
var $member2;
function Test()
{
$this->member1 = 1;
$this->member2 = array(1,2,3);
}
function WriteMe()
{
print_r($this->member1);
print_r($this->member2);
}
}
$test = new Test();
$test->WriteMe();
K uporablaš $this-> pol ni še enkrat znaka $ tko k si ti meu $this->$member1 = 1; ampak $this->member1 = 1;
{
var $member1;
var $member2;
function Test()
{
$this->member1 = 1;
$this->member2 = array(1,2,3);
}
function WriteMe()
{
print_r($this->member1);
print_r($this->member2);
}
}
$test = new Test();
$test->WriteMe();
K uporablaš $this-> pol ni še enkrat znaka $ tko k si ti meu $this->$member1 = 1; ampak $this->member1 = 1;
Robi182 ::
Hehe, ni problema. Sm jst tut začeu u C++ pa pol PHP, pa sm u PHPju tut še bl nov pa učasih take napake delam
krho ::
@Simko..... uči se php 5.2, 4.x je EOL konec leta...
class Test
{
private $member1;
private $member2;
class Test
{
private $member1;
private $member2;
si.Mail odprto-kodni odjemalec elektronske pošte. - http://www.simail.si
Uredite si svojo zbirko filmov, serij in iger - http://xcollect.sf.net
Uredite si svojo zbirko filmov, serij in iger - http://xcollect.sf.net
Zgodovina sprememb…
- spremenil: krho ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | PHP davčna blagajnaOddelek: Programiranje | 8083 (6107) | brble |
» | Regularni izraziOddelek: Programiranje | 1566 (1028) | technolog |
» | php array in path določenega keya:Oddelek: Izdelava spletišč | 1350 (1178) | HardFu |
» | [C++] std::sort problemOddelek: Programiranje | 958 (958) | nejck |
» | [java] funkcija ekvivalentna print_r v PHPOddelek: Programiranje | 1669 (1432) | sverde21 |