Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Niewidoczna metoda w klasie
arzach
post
Post #1





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 27.11.2008

Ostrzeżenie: (0%)
-----


Witam mam taki prosty kod
  1. class eps {
  2. private $_point_system_cat = array('A' => 4, 'F' => 6);
  3.  
  4. public function setPoint_system($point_cat){
  5.  
  6. if(!verification_point_cat($point_cat)) {
  7.  
  8. throw new Exception("Niepoprawna wartosc zmiennej point_cat");
  9.  
  10. } else {
  11.  
  12. $this->_point = $this->_point_system_cat[$point_cat];
  13.  
  14. }
  15.  
  16. function verification_point_cat($point_cat){
  17. if(preg_match("/^[A-Z]{1}+$/", $point_cat) && isset($this->_point_system_cat[$point_cat])) {
  18. return true;
  19. } else {
  20. return false;
  21. }
  22. }
  23. }
  24. }
  25. try {
  26. $point = new eps();
  27. $point->setPoint_system('F');
  28. } catch (Exception $error) {
  29. echo $error->getMessage();
  30. }


I dla czego wywala błąd Call to undefined function verification_point_cat()

Mimo że metoda jest napisana (IMG:style_emoticons/default/questionmark.gif) Nie rozumiem tego może mi ktoś wyjaśnić głowie się z tym już jakiś czas.

Ten post edytował arzach 23.07.2011, 09:26:49
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




A wywołujesz ją jako metodę czy funkcje? Podstawy. zapraszam do manuala.
Go to the top of the page
+Quote Post
konrados
post
Post #3





Grupa: Zarejestrowani
Postów: 623
Pomógł: 79
Dołączył: 16.01.2008

Ostrzeżenie: (0%)
-----


@wookieb: a czy metoda nie jest też funkcją? (IMG:style_emoticons/default/smile.gif) Znaczy się mamy funkcje globalne i member functions zwane też metodami, czyż nie?

@arzach: ma być:

  1. if(!$this->verification_point_cat($point_cat))
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.09.2025 - 16:05