Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a PHP program. Do it on VS code. And give the output 1. Create a new PHP file named using-arrays.php (with full HTML5

image text in transcribed

This is a PHP program. Do it on VS code. And give the output

1. Create a new PHP file named "using-arrays.php" (with full HTML5 template/page). Then add the PHP block at the top of the page (before the HTML template) as we usually do in our class to write your PHP code. 2. Create a new array and initialize it with at least 12 random integer numbers (even and odd numbers). Name this array variable: "mixedNumbers", so you need: a. to hard code the array values (typing them one by one). b. make the numbers mixed between odd and even numbers. It is up to you to choose how many odd or even numbers you want to add. c. At least 12 integer numbers must be included, but you can go beyond if you want 3. Create two empty arrays: a. An empty array called "oddNumbers": i. This array will be used for storing the odd numbers only from the mixedNumbers array b. An empty array called "evenNumbers": i. This array will be used for storing the even numbers only from the mixedNumbers array 4. Using any type of loop (iteration) structure, you need to loop through all the values of the "mixedNumbers" array and populate the values of two empty arrays (oddNumbers and evenNumbers) on the fly, so in each loop iteration we will check: If the current item (element) in the current index of "mixedNumbers" array is even number Then insert/add it into the "\$evenNumbers " array Otherwise insert/add it into "\$oddNumbers" array (c) Instructor: Anmar Jarjees Page 2 of 6 COMP1006 Introduction to Web Prog with PHP Assignment\#1 - The Essentials Georgian Lac Hint: It's a good programming practice to declare the both arrays oddNumbers array and evenNumbers arrays as empty arrays before starting insert values into them inside the loop block as clearly stated in point\#3 5. After populating the two arrays with the values (numbers), use the print_r command/function to print the three arrays: a. The original one "mixedNumbers" Contains the numbers that you hard coded b. The odd numbers array "oddNumbers" After having the array populated with odd numbers c. The even numbers array "evenNumbers" After having the array populated with even numbers NOTE: Format your output by adding break lines or horizontal rules to make it easy to read. 6. Inside the HTML body, use for loop or any type of loop structure to iterate through the both arrays "oddNumbers" and "evenNumbers" to print them using the proper HTML elements as shown in the example below

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions