Program 1
<html>
<head><title>Demo</title></head>
<body>
<center>
<?php
class Employee
{
private $empname;
private $empsalary;
private $empdept;
public function setdata($name,$sal,$dept)
{
$this->empname=$name;
$this->empsalary=$sal;
$this->empdept=$dept;
}
public function __construct()
{
echo "<br>This is Constructor method MYSQL connection success<br>";
}
// public function __sleep()
// {
// echo "<br>This is sleep method MYSQL Connection close<br>";
// return array('empname','empsalary','empdept');
// }
// public function __wakeup()
// {
// echo "<br>This is wake up method MYSQL Connection Open again<br>";
// }
}
$obj=new Employee();
$obj->setdata('Vishal','8000','CSE');
echo $obj;
// $srl=serialize($obj);
// echo $srl;
// echo "<br><br>";
// $unsrl=unserialize($srl);
// print_r ($unsrl);
?>
</center>
</body>
</html>