Question: Hi All, I need some help figuring out my PHP coding homework, it's been a hard week with full-time school and work. I appreciate the

Hi All,

I need some help figuring out my PHP coding homework, it's been a hard week with full-time school and work. I appreciate the assistance/

Each of these problems can be solved with only a few lines of PHP code, but don't be fooled into thinking they are simple problems! Don't bang your head against the wall trying to figure them out! There are a number of different solutions to both problems. Feel free to ask for help and share solutions in the discussion forum.

- Using the printf() function, write a single line of code that takes a month (from 1 to 12), a day (from 1 to 31), and a four-digit year, and displays the resulting date, formatted in mm/dd/yyyy format. Don't forget to add a zero in front of the month or day if it's less than 10.

- A factorial of any given integer, n, is the product of all positive integers between 1 and n inclusive. So the factorial of 4 is 1 2 3 4 = 24, and the factorial of 5 is 1 2 3 4 5 = 120. This can be expressed recursively as follows:

1. If n == 0, return 1. (This is the base case)

2. If n > 0, compute the factorial of n1, multiply it by n, and return the result

Write a PHP script that uses a recursive function to display the factorials of the integers 0 to 10.

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!