Homework lesson 9

Create a function that calculates the temperature to Celcius or Fahrenheit. It takes 2 arguments, a float and a string.
- The value of string MUST be 'FtoC' of 'CtoF'. If it is a different value an error should be printed.
- The return value is an array that incorparates the temperature value and the temperature type, see example below.
- Bare in mind that if another programmer should look at your code it should be obvious what you are trying to accomplish. So choose the name of your function and arguments well

with this homework assignment you are supposed to find out how you calculate this mathematically and turn that into a php function.


Example:

$returnvalue = ['temperature' => 20.1, 'type' => 'Celsius' ]; 

additional function homework (for practicing your skills)

  1. Generate a function that takes an integer $a as argument returns $a number of random numbers between 1 and 1,000,000. Print them to screen, each on a separate line.
  2. Generate a function that takes a date and returns its timestamp. print the timestamp to screen.
  3. Generate a function that takes the a mutli-dimensional array (like lesson 8 homework) and returns a string containing the table.