A return Statement from a require d File Does Not Work


A return Statement from a require d File Does Not Work

When you require d a file in PHP 3, you could have require return a value by placing a return statement in the global scope of the required file. If you want to have this functionality with PHP 4, you should use the include statement.

Valid in PHP 3

 <?php $ret = require 'somefile.php'; ?> 

Valid in PHP 4

 <?php $ret = include 'somefile.php'; ?> 


PHP Developer's Cookbook
PHP Developers Cookbook (2nd Edition)
ISBN: 0672323257
EAN: 2147483647
Year: 2000
Pages: 351

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