Question: Topics and learning objectives! 1 . Functions 2 . Dates and timestamps How to submit! Create a new directory called ` lab 0 3 `

Topics and learning objectives!
1. Functions
2. Dates and timestamps
How to submit!
Create a new directory called `lab03` in your GBLearn account at `~/public_html/labs/lab03/` and
upload your task files to this folder.
Task 1 Description
The aim of this task is to create a function that does some very basic encryption on a string.
1. Create a regular function called encrypt that takes two parameters.
The first parameter should be a string called $to_encrypt,
and the second should be an integer called $prime_num.
2. In the function, randomly generate a number between 2 and 8.
Save this random number in a variable called $rand_num.
Multiply $prime_num with $rand_num, and save the value into a new variable called $cipher.
i. Hint: use the rand_int(...) function to generate a random number.
3. Create a new variable called $encrypted, by concatenating $cipher to the beginning
and the end of $to_encrypt. Return $encrypted from the function.
4. Call the encrypt function with arguments of your choice.
Echo the returned value of the function, surrounded by tags.
ii. Otherwise, echo "You still have time!" within tags.
iii. Hint: you can temporarily change the $due_date variable to yesterdays date,
to make sure that the late submission message shows as expected.
4. Test your work and ensure the following code is included at the bottom of any uploaded files
echo "

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 Programming Questions!