problema cu includerea unei functiii in clasa

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator


Avatar utilizator
UnD3aD
Senior Member
Mesaje: 351
Membru din: Lun Apr 10, 2006 2:01 pm
Localitate: Cta
Contact:

Mesajde UnD3aD » Lun Sep 18, 2006 6:41 pm

daca functia apartine clasei si clasa e singleton o poti apela astfel:
Numeclasa::functie()
daca nu e singleton trebuie sa creezi intai un obiect al clasei si dupa apelezi functia:
$numeObiect = new NumeClasa;
$numeObiect->functie();
Programming is like chewing a pack of bubble gum. If you chew it all at once you're going to die.



demonu
Average Member
Mesaje: 76
Membru din: Mie Apr 12, 2006 8:16 pm
Contact:

Mesajde demonu » Lun Sep 18, 2006 7:46 pm

UnD3aD: Singletonul este altceva. Ce ai zis tu acolo cu Numeclasa::functie() e pentru metode statice.


Avatar utilizator
Dodo
Senior Member
Mesaje: 958
Membru din: Mar Aug 22, 2006 2:40 pm
Localitate: Constanta
Contact:

Mesajde Dodo » Lun Sep 18, 2006 7:49 pm

Daca functia este definita in clasa o apelezi cu $this->functie(); daca este externa o apelezi cu functie();
|

Avatar utilizator
fabby
Senior Member
Mesaje: 1071
Membru din: Lun Aug 30, 2004 11:51 pm
Localitate: Bucuresti
Contact:

Mesajde fabby » Lun Sep 18, 2006 10:04 pm

Today is a good day for... php

www.anunturi-utile.ro - anunturi gratuite

Avatar utilizator
UnD3aD
Senior Member
Mesaje: 351
Membru din: Lun Apr 10, 2006 2:01 pm
Localitate: Cta
Contact:

Mesajde UnD3aD » Lun Sep 18, 2006 10:15 pm

Programming is like chewing a pack of bubble gum. If you chew it all at once you're going to die.






Avatar utilizator
fabby
Senior Member
Mesaje: 1071
Membru din: Lun Aug 30, 2004 11:51 pm
Localitate: Bucuresti
Contact:

Mesajde fabby » Lun Sep 18, 2006 10:31 pm

Today is a good day for... php

www.anunturi-utile.ro - anunturi gratuite


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 30 vizitatori