Follow the approach of writing program using proper steps to solve.
- Read assignments program more than once before starting.
- Write down your understandings in the sequence of steps. Write down the algorithm.
- Write down pseudo-code/ rough code on paper before coding.
- Verify the steps written and assumed output correct or not.
- If you satisfied with the steps and pseudo code then start writing the actual program.
PHP Programming Assignments as follows:
1.Create an array with elements as numbers from 1 to 10. Use simple for loop to print array elements on the single line.
2. Create an array with elements as numbers from 1 to 10. Use simple for loop and print values of the array by multiplying by 2.
3. Create a function named “printTable” having one parameter named “number”. Create an array with elements as numbers from 1 to 10 inside function printTable. Call printTable function with parameter 2 to 10 one at a time. Inside function use a simple for loop and print value of array by multiplying with the passed parameter.
4. Create a function named printTable having one parameter named “number” and another parameter as numarray. Create an array with elements as numbers from 1 to 10. Call printTable function with parameter 2 to 10 one at a time and numarray as parameters. Inside function use simple for loop and print value of an array by multiplying with a passed parameter.
5. Create an associative array for employees information with keys as firstname, lastname, empid, salary and their respective values and print them using foreach loop.
6. Create an associative array for employee information with keys as firstname, lastname, empid, salary and their respective values. Use foreach loop to iterate through array elements. Check keys inside the loop and if the key equals to salary multiply it by 1000 and print it on screen.
Try to solve the above basic PHP Programming Assignments.