|
home—lects—hws
D2L—breeze (snow day)
<?php error_reporting(E_ALL|E_STRICT); ini_set('display_errors', 'stderr'); ini_set('display_startup_errors', true); ?> |
Reason: Before the first line of your program is run, php parses your entire file. If you have a missing semicolon on line 20, then line 1 will never even be run.
Solutions:
In practice, I do both (a) and (c).php.radford.eduis running php 5.3.
As we saw,
we can combine values (to use as an argument to
See also various error functions.
We can shorten silly-page-php.txt
to
silly-page-v2-php.txt.
(Self-quiz: Why can't I do a show-source of silly-page.php, to see the php code?)
Compare echoing “
"hello" . 17 'hello' "he'llo" 'he"llo' $myName = "Ian" "hello, $myName.\nBye." 'hello, $myName.\nBye' strlen("hi\n") strlen('hi\n') |
Take-away: I recommend using
Note: Arguably, php, with all its flaws, owes its success entirely to that variable-substitution, and the convention that anything not inside a php processing-instruction should be literal output. (FWIW, a better way to blend code with large amoutns of literal-text-data is racket's “scribble” syntax: it nests better, and generalizes better.)
1Later, we'll have php programs that only run in response to a form-submission.
You can still run these from the command-line:
make an test-file which initializes an array named
home—lects—hws
D2L—breeze (snow day)
©2013, Ian Barland, Radford University Last modified 2014.Jan.31 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |