Program 1
<html>
<head><title>Demo</title></head>
<body>
<center>
<?php
class MyMath
{
public function addition($a,$b)
{
$c=$a+$b;
return $c;
}
public function subtraction($a,$b)
{
$c=$a-$b;
return $c;
}
public function max($a,$b)
{
if($a>$b)
return $a;
else
return $b;
}
}
class Abc
{
public function display()
{
echo "<font color=red size=5>This is display of class Abc file is TestClass.php</font>";
}
}
?>
</center>
</body>
</html>Program 2
<?php
require 'TestClass.php'
?>
<html>
<head><title>Demo</title></head>
<body>
<center>
<?php
$M=new MyMath();
$c=$M->addition(50,20);
echo "Addition is: ".$c;
echo "<br>";
$c=$M->subtraction(50,20);
echo "Subtraction is: ".$c;
echo "<br>";
$c=$M->max(50,20);
echo "Grater is: ".$c;
$M1=new Abc();
$M1->display();
?>
</center>
</body>
</html>Program 3
<?php
namespace one
{
class InfoData
{
public function __construct()
{
echo "<font color=red size=5>This is a Constructor of Info Data Class of Student.php</font>";
}
}
}
?>Program 4
<?php
namespace two
{
class InfoData
{
public function __construct()
{
echo "<font color=green size=5>This is a Constructor of Info Data of Employee Class of Employee.php</font>";
}
}
}
?>Program 5
<?php
require 'Employee.php';
require 'Student.php';
?>
<html>
<head><title>Demo</title></head>
<body>
<center>
<?php
$S1=new one\InfoData();
$S2=new two\InfoData();
?>
</center>
</body>
</html>