Question: Questions 1 . Edit the following code to specify that $totl is a floating point number with five decimal places after the decimal point (

Questions
1. Edit the following code to specify that $totl is a floating point number with five decimal places after the decimal point (fill in the two placeholders ___ with proper code).
printf ("Total amount of order is ___",_____);
2. Edit the following PHP code to echo the value 6 to the browser (fill in the two placeholders ___ with proper code).
$test = "Hello Mama";
echo strpos($test, "___",___);
3.Use the PHP require function to include the contents of the file reduce.php in your current script.
4. Make a call to a PHP compute() function by passing in the variable $variable with a value of 82.
5.Write function named winStat that accepts a parameter called condition and outputs the string Window open if condition is TRUE and Window closed otherwise;
6. Modify following PHP function to ensure that only the first echo statement is executed. Make your edit is as compact as possible, using the blank underline_____ as your guide.
function testrtn(){
echo "This statement will be executed";
_____ ;
echo "This statement should not be executed";
}
7. Edit the following PHP class definition to add a public attribute named attr1.
class MClass
{
_________________;
}
8. Define an object named $tiny that instantiates an instance of the class House, using no parameters and one command.
9.Modify the following code to specify that the R class is a subclass of the Q class. (fill in the placeholders ___ with proper code).
class ___________ ;
10.Define a PHP variable named $i that is a copy of object $obj of the same class with the same attribute values.
11. Modify the following PHP code in such a way that you trigger the exception-handling mechanism using the myException class.
___ new ___($msg, $code);
12. Modify the following PHP code such that it runs cleanly.
___{
// do something, maybe throw some exceptions
}___(Exception $e){
// handle exception
}
13.Modify the following code to trap exceptions of the myException class and store the results in the variable $o.
catch (______)
{
// handle exception
}
14. Explain what the PHP built-in class Exception is used for and name at least two methods in it and provide examples of when each might be used and why.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!