03c630cd1b347346a2167ae176559ed6 htmlphp lab5 v2 rasb14 2017-10-15 19:56:32 v2.3.4 (2017-10-09)
Generated 2017-10-15 21:56:51 by dbwebb lab-utility v2.3.4 (2017-10-09).
This lab pretty much deals with getting youreself acquainted with the PHP Manual. Search, find and read. It will be fun.
In this section you will be working with the DateTime-object. If you manipulate the object, such as add or subtract, the original object will be changed, hence you will create new objects from the same date in these exercises.
Read more on datetime in the manual.
Use new DateTime() to create a new DateTime-object from the date: 2001-05-12 11:15:17. Format the object to present the year-month-day, Y-m-d and answer with the result.
Create a new DateTime-object with the same parameters and add 3 months to it. Answer with the result, presented in the format: Y-m-d.
Use one of your DateTime-objects and answer with the time, presented in the format: hours:minutes:seconds.
In this section, you will be working with the file: Frankenstein.txt. It contains a paragraph from a book and can be found in the lab folder.
Use file_get_contents() to get the file as a string. Save it to a variable called fileAsString. Answer with the variable.
Use file_get_contents() to get 25 characters, starting on the 17th character.
Use the file serialized.txt in your lab folder and read it, unserialize it and put the result in your answer.
(Tips: Take a peek into your ‘serialized.txt’ to see how a serialized array looks)
Reference to password_hash and rot13.
Use password_hash() with the DEFAULT algorithm to create a hash of the password: "myPassword". Test password_verify() with different passwords to see what it returns. Answer with the result, using "myPassword".
Use ROT13 encoding on your password: "myPassword". Answer with the result.
Use ROT13 decoding to find which movies hides in the string:
“Pvaqreryyn, Ynql naq gur Genzc, Byq Lryyre, Gernfher Vfynaq, Gur Whatyr Obbx”
Each movie is comma-separated in the string above.
Answer with an array containing all answers.
Calculate the hash of the password "myPassword" with md5. Answer with the hash.
Set the internal encoding to ISO-8859-1. Answer with the result of mb_internal_encoding().
Check the strlen() and mb_strlen() of the word "skärgårdsö". Answer with the two results as a comma and space-separated string.
Set the internal encoding to UTF-8 and check the strlen() and mb_strlen() of the word "skärgårdsö". Answer with the two results as a comma-separated string.
These questions are worth 3 points each. Solve them for extra points.
Create a new DateTime-object based on the same date and time and subtract 5 days and 3 hours from it. Answer with the whole date, presented in the format: Y-m-d hours:minutes:seconds.
Use a combination of implode() with a space as a delimiter and explode() to format the file content and remove newline characters. Answer with the result.
03c630cd1b347346a2167ae176559ed6