|
Due
Submit on D2L, and a hardcopy.
For this homework, you'll submit three files:
utils.php,
utils-test.php,
and
silly.php.
The files silly.php does not need to be viewable on the web.
Notes:
Note that this is just a regular ol' function that takes in strings and returns strings!
The fact that the strings happen to have angle-brackets in them means that the result might
be useful to people generating html, but the function itself doesn't really care.
(You don't need to come up with additional test cases, but you do need to actually include these tests or their equivalent. You can assume that neither string is ever empty.)
Note how the input strings don't contain any quote-characters, but the returned result does (since HTML attributes must be quoted). I recommend that your generated html uses single quote marks around attributes, but you'll get full credit for either single- or double-quote marks, as long as it is valid HTML. Make sure your test case(s) express exactly what the ideal, desired result is!
Turn your previous answer
into a (runnable) test-case for
You don't need further test-cases for this problem.
Do, however, pay close attention to the exact spacing you want to have.
I recommend using single-quotes (
For full credit, your function should call
If you like: You can run your program, and to make sure what it printed is valid xhtml, you can redirect (or, paste) your output into a file, and then open that local-file via a browser's File » Open…. But observe that in this process, we are not actually accessing/using the web at all.
Let me know if you have a better name for the function; an ibuck awarded if I accept it.
↩Let me know if you have a better name for the function; an ibuck awarded if I accept it.
↩This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |