Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a PHP program. Do it on VS code . 1. Create a new PHP file named product-fun.php (without any HTML). Then add the

image text in transcribed

This is a PHP program. Do it on VS code .

1. Create a new PHP file named "product-fun.php" (without any HTML). 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. In the main PHP script block, create and initialize an array of different integer values with any name you like/prefer. Example: 3. Inside the main PHP script, create a function with any name you prefer that accept one argument (parameter) of array type and returns the result of multiplying all the values inside the array (the product of all the array element). 4. The function will accept an array name as an input argument (parameter), then find the product (the result of multiplying all the array's value): Example: The array above has these values (numeric elements): Using the proper code find the result (product) of multiplying all the elements: product =34222815020; Then: return product 62832000 5. You will make your function more sophisticated by scanning each value inside the array using the builtin PHP function is_int() by looping through all the elements before trying to multiply it by the next value. if one of the elements is not an integer value the function (loop) should be stopped by returning 0 value (using return statement) 6. You need to echo the result of the returned value from the function (echo the product). do not put the echo/print inside the function as this function is supposed to return a value only which is the product

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions