uma will you please help me making classes to check prime numbers...
I wrote the following code:: but its not working..
<?php
// define class
class Calculator
{
//class variables:
var $i;
//Class member functions or methods:
function Isprime($number1)
{
$this->i=$number1;
if($this->i < 2)
{
//return false;
echo "hello";
}
for($j=2;$j<=(($this->i)/2);$j++)
{
if($this->i % $j ==0)
{
//return false;
echo "hi";
}
}
//return true;
echo "welcome";
}
}
$num1=$_POST['number1'];
//Create a class instance:
$calc = new Calculator();
//Call class methods:
$calc->Isprime($num1);
//Display output:
?>
please tell me whats wrong with this
Aug 3, 2010