Objective

Create a function to multiply all the numbers in a given array and return the product.

Difficulty

Very easy

Description

Consider the following array of numbers:

<?php

$nums = [1, 5, 70, -2, -1, -0.5];

If we multiply all the numbers together, we get the value -350.

In this exercise, you ought to create a function multiply_all() that takes in an array of numbers and returns back their product.

If the array is empty, the value returned should be NULL.

Here are some examples of the usage of the function:

<?php

echo multiply_all([1, 5, 70, -2, -1, -0.5]), "\n";
echo multiply_all([2, 2, 2]), "\n";
echo multiply_all([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), "\n";
var_dump(multiply_all([]));
-350 8 3628800 NULL