Question
This is a PHP file. The first test for the number of 10 is working. But I want to add more cases such as negative
This is a PHP file. The first test for the number of 10 is working.
But I want to add more cases such as negative number, zero and character(a?b?c?), can you help me to fix it?
I have put the tester at the bottom, now i am trying to figure how to write in the primeFucntion in order to pass those tests. please help me! Thank you!!
function primeFunction($input){
$num = 2; $result="";
while ($num
if($count
function tester($actual, $expect){ if (strcmp($actual, $expect) == 0 ){ echo " Test passed "; } else{ echo " Test not passed "; }
}
tester(primeFunction(10),"2 3 5 7 "); tester(primeFunction(-10),"negative number is invalid"); tester(primeFunction(0),"zero is invalid"); tester(primeFunction(a),"please enter number");
?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started