Section A.5. Chapter 5


A.5. Chapter 5


Solution to Question 5-1

This isn't a valid function. It's missing the parentheses and furthermore, it's bad style to mix functions with your main code.


Solution to Question 5-2

To define the toast function with a parameter:

 <?php function toast( $minutes ) {   //do the toasting here   echo ("done."); } ?> 


Solution to Question 5-3

To call toast with 5 as the minutes parameter:

 <?php toast(5); ?> 


Solution to Question 5-4

When you are using include() and a file can't be found, only a warning issues. However, when you are using require(), a missing file causes a fatal error that terminates the execution of the script.


Solution to Question 5-5

A method.



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