Task 2: Characters, Strings And Arrays
Make an array, indexed with integers, containing at least 5 famous quotes, sayings or similar
phrases. At least one phrase must contain characters not present in the English alphabet/US_
ASCII. You must use UTF-8 for this assignment. Using a GET-variable chose one of these phrases
and perform the following operations on it (always starting with the original string). Output the
results in an understandable way.
- Convert all letters to upper case.
- Count the number of characters.
- Remove all vowels.
- Reverse the string.
- Find the first 5 and the last 5 characters.
- Extra hard: Reverse the words in the string, but keep their order.
- Extra hard: Put emphasis (em) on every other word.
- Extra hard: Truncate the string to max 15 characters followed by … Truncate on a
word boundary, not inside a word.
Loop through all phrases and output them as a list of links, with GET-parameters, to make the
selection described above really easy. Use a whitelist approach for indata filtering, using type
and range checks.
Use PHP to sort the array. Use print_r() or var_dump() to display the result. (Note: This is intended
to show basic awareness of these two functions for debugging purposes.)
Task 3: Using PHP As A Template System.
Make a simple web site with at least 3 types of pages and 2 instances of each type. All
types shall share a common masthead, footer and navigation. Make a page controller for
each page and set title, heading and other data in variables. Make a master template for
every type of page, that in turn will include the smaller page parts.
Task 4: Templates And Emulated Database Results.
Expand on Task 1. Set data in a multi-dimensional array (emulating database
Chose what "row" (inner array) to show with a GET-variable. All rows must have a titlefield
and a body-field containg at least 3 full paragraphs of text. Check for appropriate
values (filter input) and html-escape the output, as if it came from an untrusted
source, before putting it into the templates. If the GET-value is unacceptable, show an appropriate
error page. Use a whitelist approach for indata filtering, using type and range checks.
Loop through all "rows" in the outer array and ouput a menu with links to all, using the
title field for link text.
Được trao cho:
5 freelancer đang chào giá trung bình ₱2420 cho công việc này
Hello, We have our experienced team who can take care of this in 5-7days. kindly write to us to proceed further. Quality and speed of work is assured with 100% of your satisfaction. Thanks.
Stromz, I have done something like Task 2 in the past, and I'm currently working on something like Task 3 in my daily job, but can you kindly add Task 1 as Task 4 depends on it?