Re: conditionaly including classes/functions
| From: | CC Zona | Date: | Fri, 05 Apr 2002 18:30:35 +0000 |
| Subject: | Re: conditionaly including classes/functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91771@lists.php.net to get a copy of this message | ||
In article <f05100303b8d23ce1c0d5@[217.37.50.73]>,
andrew@like.com (Andrew Warner) wrote:
> Is it okay practice to condtionally include php files that contain
> only classes or functions (as opposed to just straight code)? The
> result is a class or function inserted right in the middle of an if{}
> block:
>
>
> } elseif ($var=='a')
> {
> include('temp.php');
>
> $obj = new foo;
> echo $obj->hello();
>
> }
It's fine, but since redeclaring functions is an error, better to use
include_once() or require_once().
--
CC