RE: [PHP] Undefined Variable errors
| From: | John W. Holmes | Date: | Mon, 11 Nov 2002 20:01:40 +0000 |
| Subject: | RE: [PHP] Undefined Variable errors | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123884@lists.php.net to get a copy of this message | ||
> I'm migrating to PHP from ColdFusion.
>
> I've been running some sample scripts I have found in various places
and
> all
> of them throw an error:
>
> Notice: Undefined variable: <varname> in
> c:\inetpub\wwwroot\myphpcalendar\<somefile.php> on line <someline>.
>
> In ColdFusion, I can use the <cfparam> tag to preset a variable. I've
> tried
> the following code to define the variable in PHP, but it doesn't work:
>
> if (!isset($VarName)) {
> $VarName = 0;
> }
How does that "not work?" It should, as long as you're including the
line before the others that are giving you the notice.
You can also turn down your error_reporting setting in php.ini. You can
turn off notices and just see warnings. There is an example within
php.ini.
---John Holmes...