Question
1. Create $courseName1, $courseName2, $courseName3 (e.g. Advanced Web Development) to store all names of the courses you are taking this semester. Use $GLOBALS to store
1. Create $courseName1, $courseName2, $courseName3 (e.g. Advanced Web Development) to store all names of the courses you are taking this semester. Use $GLOBALS to store course names. Use the course code (e.g. CIS 475) as the index for this array and course name as the corresponding value.
2. Write a function fixCourseName($courseName) to make sure that every course has a name following this format: each word of this course name starts with an uppercase letter (e.g. Advanced Web Development). If not, convert it before storing it in the array by calling this function which takes $courseName1, $courseName2, $courseName3 as an input. Use the output of this function as the value stored to the $GLOBALS array.
3. In the main program of your PHP script, add each course you are taking this semester to the $GLOBALS array. Try some course names that are not in the correct format and see if your fixCourseName function does its job. After storing all of your course information, print out a message like that:
The courses I am taking this semester are: CIS 475 - Advanced Web Development, CIS 366 - Introduction to .NET Development Using C#, CIS 429 - Information Systems With Business Intelligence.
Hint: Do not print out message manually. Use a for or foreach loop to read course codes (keys) and course names (values) from the $GLOBALS array. Use string concatenation method to combine information read from your array and other messages
Here is what I have to far:
$course1 = "advanced web development";
$course2 = "mobile app development";
$course3 = "info systems with business intell";
$GLOBALS(
"CIS475" => "advanced web development",
"CIS360" => "mobile app development",
"CIS429" => "info systems with business intell"
);
function fixCourseName($courseName)
{
$courseName = ucwords($courseName);
}
?>
I do not understand how I'm going to link the function to the first created variable or to the $GLOBALS array.
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