The following are my responses to a series of simple PHP problems (attached in the Word File). I needed to review Doyle (2010) chapters 9 and 10 which cover form submission and session variables in order to complete these exercises. I also leaned on chapter 18 which goes into depth on regular expressions to assist with pattern recognition.
Execute each of these programs via the links provided below:
This program reads a non integer range (between 0 and 20) and prints the powers of 2 from 1 to 2N. This exercise was the easiest of the assigned tasks to complete.
This program take a list of team names, and print them vertically.
This program reads input values, n and m, and output the number of different combinations of m things that can be formed from a group containing n members. I had a difficult time coming up with the actual factorial calculation and upon further research I was able to use a snippet of code from http://php.net/manual/en/ref.math.php to help me solve this problem.
This program prompts for a password and returns its strength based on length, symbol / numeric use and upper and lowercase letters.
This program prompts for the size of a number spiral (which must be an odd number between 1 and 19). It then outputs to the screen the number spiral, with the numbers aligned vertically with the least significant digits.
Out of all the exercises I had the most trouble trying to figure out a way to accomplish this correctly. In the end I could not solve this exercise. Instead, I borrowed code from a previous solution posted here: http://stackoverflow.com/questions/6632645/php-spiral-with-numbers-0-to-9. I modified the code to improve on the formatting and also to allow for user input of the size of the spiral.
Image Credits: Photo by Isis França on Unsplash.