Question: Write a program in PHP that defines a class titled MyInteger. The class is to hold a single integer that is set in the constructor
- Write a program in PHP that defines a class titled MyInteger. The class is to hold a single integer that is set in the constructor by a parameter. The class is to have methods isEven(int) and isOdd(int).
- In addition, the class will have an isPrime() method.
- Lastly, you are to have a getter and setter method.
- Create two instances and test all methods.
- Title the PHP class as
MyInteger. - Title the PHP file as
MyFirstClass.php.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
