<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Array Object Vales</title>
</head>

<body>

<form action="array_object_values.php" method="post"><input type=text name="color">

<input type="submit" value="click"</form>
</body>

</html>
 

 

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>class and object</title>
</head>

<body text="#FFFF00" bgcolor="#000080">
<?php
$xcolor=$_POST['color'];

class ColorFilter {
var $color ;
function ColorFilter($color) {
$this->color=$color;
}
function isPrimary () {
$primary=array('red','green','blue');
if (in_array($this->color,$primary))
return true;
else
return false;
}
}

//$myColor='red';

echo "You entered $xcolor <br>";
$filter=new ColorFilter($mycolor=$_POST['color']);

if ($filter->isPrimary($myColor) ) {
echo ($myColor.'<br> It is a primary color');
} else {
echo ($myColor.' <br>It is not a primary color');
}

?>
</body></html>