Section A.17. Chapter 17


A.17. Chapter 17


Solution to Question 17-1

Some PHP interpreters may not be configured to execute PHP code that starts with <?. It can also cause problems with XML parsing.


Solution to Question 17-2

The // comment style comments out the current line only, while /* comments out lines until a matching /* comment is encountered.


Solution to Question 17-3

If you are using include_once() and an include file is accidentally included more than once, a function redefinition error will not occur. This can easily happen when included files contain their own include lines.


Solution to Question 17-4

The code should follow the coding conventions to make it easy to read and portable:

 <?php /*  * this file welcomes the user.  * this file welcomes the user and uses proper code styles.  *  * Copyright 2006 (c) O'Reilly & Associates  *  * @version   $Id: coding_standards_example.html,v 1.2 2006/1/19 24:49:50  *  */ //verify the user if ($_GET[user_id] == 'Admin') {   //Welcome the admin user to the control panel.   echo ('Welcome to the control panel.'); } else {   //Welcome other user.   echo ('Welcome.'); } ?> 



Learning PHP and MySQL
Learning PHP and MySQL
ISBN: 0596101104
EAN: 2147483647
Year: N/A
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net