PHP/Class/Class Instance
Версия от 10:37, 26 мая 2010; (обсуждение)
Create Class instance
<?php
class ClassName{
var $var1;
var $var2;
function myfunction1(){
$result = "$this->var1 and $this->var2";
return $result;
}
function myfunction2(){
$myfunction1 = $this->myfunction1();
return $myfunction1;
}
}
$myclass = &new ClassName;
$myclass->var1 = "A";
$myclass->var2 = "B";
echo $myclass->myfunction1()."<br />";
echo $myclass->myfunction2()."<br />";
?>