프로그래밍/PHP

class 생성자, 소멸자..

Crazy_Kong 2006. 5. 30. 11:41

class Person{
  function __construct($name){
   $this->name = $name;
  }

  function getName(){
   return $this->name;
  }
 }

 $judy = new Person("judy");

 print $judy->getName();

 

$judy = null;

 

__construct() <--- 생성자

 

보통 클래스 네임하고 같은 이름으로 정의를 했었는데 .. 난감하다..

 

$judy = null; <--- 소멸자  어이 없음.