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!
Functions
Dates and timestamps
How to submit!
Create a new directory called lab in your GBLearn account at ~publichtmllabslab and
upload your task files to this folder.
Task Description
The aim of this task is to create a function that does some very basic encryption on a string.
Create a regular function called encrypt that takes two parameters.
The first parameter should be a string called $toencrypt,
and the second should be an integer called $primenum.
In the function, randomly generate a number between and
Save this random number in a variable called $randnum.
Multiply $primenum with $randnum, and save the value into a new variable called $cipher.
i Hint: use the randint function to generate a random number.
Create a new variable called $encrypted, by concatenating $cipher to the beginning
and the end of $toencrypt. Return $encrypted from the function.
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 $duedate variable to yesterdays date,
to make sure that the late submission message shows as expected.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
