Re: [PHP-DEV] include_once() return values ? From: Stig Sæther Bakken (ssb <email protected>)
Date: 07/28/00

Alan wrote:
>
> Hi All,
>
> Question: what would you expect include_once() to return on the second attempt to include the same file?
>
> On the first attempt it behaves like include(), returning the return value of the included file, or the int(1) if there is no return statement in the included file.
>
> At the moment include_once() always returns NULL on the second attempt so defensive coding like this wont work:
>
> if(! <email protected>("$somefile"){
> // handle failled include attempt
> }
>
> ( note that this example is based on ideas implemented in pear DB::connect() )
>
> Is this intentional (feature request material) or bug report time ?

(FYI: DB::factory() and DB::connect() don't do this anymore.)

But I agree with you, the return value if the file was already included
should be true. This is what I would expect, and it is consistent with
include.

 - Stig

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>