php 类定义和类实例使用范例
<?php
class emp
{
var $name;
var $address;
var $dept;
function assign_info($n,$a,$d)
{
$this->name=$n;
$this->state=$a;
$this->dept=$d;
}
function display_info()
{
echo("<p>Employee Name : $this->name");
echo("<p>State : $this->state");
echo("<p>Department : $this->dept");
}
}
$empobj = new emp;
$empobj->assign_info("kaka lname","California","Accounts");
echo("<center><h2>Displaying Employee Information</h2></center>");
echo("<font size=4>");
$empobj->display_info();
echo("</font>");
?>
