Question: 1. Find and correct the mistakes in the PHP code. 1). (10 points) A mistake is found in ___________. ( Put the line # of

1. Find and correct the mistakes in the PHP code.

1). (10 points)

$majors['CS'] = 'Computer Science'; //Line 1

$majors['MTH'] = 'Mathematics'; //Line 2

echo "The two majors are $majors['CS'] and $majors['MTH']"; //Line 3

?>

  • A mistake is found in ___________. (Put the line # of the statement as your answer)

  • The corrected statement is _______________________________________________.

2). (10 points)

$name = "John"; //Line 1

$age = 30; //Line 2

$gender = "M"; //Line 3

if($gender == 'M') //Line 4

$print = 'man'; //Line 5

$person_info = "$name. is a . $age . years old . $print; " //Line 6

echo $person_info; //Line 7

?>

  • A mistake is found in ___________. (Put the line # of the statement as your answer)

The corrected statement is _______________________________________________.

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