|
home—lects—hws
D2L—breeze (snow day)
Accompanying video:
Review: show the result of requesting hello-world_php.txt (result: hello-world.php).
The server, seeing the suffix “.php”, is configured (presumably) to
run that file as a php program, and whatever that program prints is what the server
sends back to the client.
SO: when our browser visits on hello-world.php, and we do a show-source, do we see the php program? NO! (Why not? Let's reread the above paragraph!)
Wait: So how am I displaying the source, if the server doesn't send you the program? For this one example, I happened to make a copy of the php file, and re-named it ending in “txt”. When requesting that file, the server did not consider it a php program and didn't run it; instead it just returned that filed. It looks funky; do a show-source and then tell me why the client is displaying the source-code in a very odd way.
Task:
the function
For any programming task (from 120 on up, including web programming), we start with test cases, which are runnable code:
echo "actual: ", blend("motor", "hotel"), "\n"; echo "expect: ", "motel", "\n"; echo "actual: ", blend("smoke", "fog"), "\n"; echo "expect: ", "smog", "\n"; |
So, let's make some further test cases.
What should
What should
We'll continue next time: What other inputs should we test?
home—lects—hws
D2L—breeze (snow day)
©2017, Ian Barland, Radford University Last modified 2017.Sep.01 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |