Re: RE: help, weird include problem with functions
| From: | Renze Munnik | Date: | Thu, 09 Aug 2001 17:51:34 +0000 |
| Subject: | Re: RE: help, weird include problem with functions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62026@lists.php.net to get a copy of this message | ||
On Thu, Aug 09, 2001 at 01:15:41PM -0400, Jaxon wrote:
> hmm...yes, it does work, I jumped the gun on the simple example, cuz I
> thought it was an echo problem..
> my un-simplified example has an opendir() in function foo() file.
>
>
> function.php is:
> <?php
> function foo{
> global $bar;
> echo "$bar from foo"; //this is working
> $handle=opendir("$bar/common/"); // I get a "OpenDir - no such file or
> directory"
> //some more stuff here to handle directory maniuplaion
> }
> foo();
> ?>
>
> so the simple example does indeed work, but the opendir() is choking trying
> to deal with the variable.
>
> hmmm...
>
> jaxon
>
Are you sure the directory you try to open actualy exists?
Btw... for things like this you better use:
if (!($handle = opendir ("$bar/common/"))) {
// Some error here, and don't try to use $handle after this!
}
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««