Question: I need this in PHP language Create the Word List pages (Script 7.6 and 7.7 code from this chapter) on your website. Enhance the page(s)
I need this in PHP language
- Create the Word List pages (Script 7.6 and 7.7 code from this chapter) on your website.
- Enhance the page(s) as follows.
- Add form validation so it attempts to parse and sort the string only if it has a value.
- Use 'foreach' instead of 'implode()' to print out each sorted word on its own line.
- Display a var_dump of the sorted word array at the end of the PHP script page (for debugging).
I Must Sort This Out! Enter the words you want alphabetized with each individual word separated by a space:
-
I Have This Sorted Out // Address error management, if you want.
// Turn the incoming string into an array: $words_array = explode(' ' , $_POST['words']);
// Sort the array: sort($words_array);
// Turn the array back into a string: $string_words = implode(' ', $words_array);
// Print the results: print "
An alphabetized version of your list is: $string_words
";?>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
