php tutorial scripts, feedback

From: Date: Wed, 12 Jun 2002 15:11:03 +0000
Subject: php tutorial scripts, feedback
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-10806@lists.php.net to get a copy of this message
Please update your tutorial to notify users that copy-paste of sample scripts will produce an error according to this newsgroup article, which helped me discover the problem after hours of other troubleshooting: It is an extremely baffling problem, not least because this code is on the basic PHP tutorial at www.php.net/tut.php. The exact copied code is this: <html><head><title>PHP Test</title></head> <body> <?php echo "Hello World<p>"; ?> </body></html> Looks fine eh? Well, no, it isn't. Copy the code (from the webpage, not here) and examine the hex. For the problem part (' echo '), the hex is: A0 65 63 68 6F A0 Which causes a problem, since the A0's are _not_ spaces, but some other ASCII character (shown in most typesets as ' ' or 'á'). So what PHP is actually parsing is this: <html><head><title>PHP Test</title></head> <body> <?phpáechoá"Hello World<p>";á?> </body></html> Which is obviously horribly broken. Re-type the spaces and all should be well.

« previous php.mirrors (#10806) next »