Answer the question
In order to leave comments, you need to log in
How to pass a value to a class method?
No matter how I twist, then one error then another:
class Calculator
{
public function add($date)
{
$my = trim($date);
$D = explode(",", $my);
$l = strlen($DArr[2]);
if(1 <= $D[0] && 31 >= $D[0] && 1 <= $D[1] && 12 >= $D[1] && $l == 4){
return true;
}
else{
return false;
}
}
}
$class = new Calculator;
//$class->$date='12,11,2009';
$class->add(12,11,2009);
var_dump($class);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question