Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!!

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

Describe the classification of secondary data?

Answered: 1 week ago