[nycphp-talk] require[_once]: what the heck?
Allen Shaw
ashaw at iifwp.org
Wed Sep 22 11:23:17 EDT 2004
Hi Folks,
This is really weird, so I'm asking greater minds than mine:
Any ideas what could make a required file not return its stated return
value? This is driving me nuts, but in one specific instance, code
something like this: <? $a = require ('requiredfile.php'); ?> is giving me
NULL for $a.
If I change that require statement to be require_once, I get the return
value with no problem. And of course in any other situation everything
works fine -- that is, if I make a sample script to test just these few
lines of code in the same environment, I get the result you'd expect. And
on top of that (extra clue!), if I run this same set of code on my local dev
machine (Windows, php 4.3.7) it works fine, just not on my production
(linux, php 4.1.2) machine.
For context, this code is contained inside of a custom class that's
basically adding features to the Smarty engine, and the actual code is:
$arReturn = require_once ($this->modulesDir."/".$this->module.".php");
or
$arReturn = require ($this->modulesDir."/".$this->module.".php");
And a typical required file contains:
return array ('result',"Completed: $result");
What the heck am I missing here?
- Allen
More information about the talk
mailing list