E_NOTICE:
http://www.php.net/manual/en/phpdevel-errors.php#internal.e-notice
http://www.php.net/manual/en/configuration.php#ini.error-reporting

The following won't create a E_NOTICE level error when $var is not set:

  if (isset($var) && $var == 'foo') {
    echo 'I Love to foo';
  }

Could also use a @ but it's not as cool imho :)

  if (@$var == 'foo') {
    echo 'I love to foo';
  }

So as suggested, this depends on your particular settings.  Also see the
error_reporting() function.

regards,
Philip Olson


On 30 Nov 2001 [EMAIL PROTECTED] wrote:

> ID: 14296
> Updated by: hholzgra
> Reported By: [EMAIL PROTECTED]
> Old Status: Open
> Status: Feedback
> Bug Type: Variables related
> Operating System: Win2k
> PHP Version: 4.0.6
> New Comment:
> 
> looks like you have set error_reporting to E_ALL
> while you had E_ALL & ~E_NOTICE before?
> 
> maybe by using php.ini-recommended as template
> for php.ini with 4.0.6 while using php.ini-dist
> for the former versions?
> 
> Previous Comments:
> ------------------------------------------------------------------------
> 
> [2001-11-30 04:15:44] [EMAIL PROTECTED]
> 
> 
> SYSTEM:
> I use PHP 4.0.6 on Win2k pro with Apache 1.3.22 win
> Loaded modules don't seem to make a difference for the described behaviour.
> 
> DESCRIPION:
> Let's say we have a PHP script, the retrieves some variables via HTTP post or get. 
>And the variables, passed to the script, have different names each time.
> Usually we would use "isset($variable)" to check if it exists. In most cases we need 
>to check the content of the variable too. So it would be nice to do that in one step.
> 
> The script of the following examples retrieved $var1 or $var or both of them via 
>HTTP.
> 
> EXAMPLE 1:
> // This would be the usual way i guess
> if(isset($var1)){
>   ...
> }
> if(isset($var2)){
>   ...
> }
> 
> EXAMPLE 2:
> // This has been possible with PHP 3.xx - 4.0.5
> // without previously checking for existence 
> // of $var1/$var2
> if($var1 == "something"){
>   ...
> }
> if($var2 == "anything"){
>   ...
> }
> 
> EXAMPLE 3:
> // With PHP 4.0.6 we would have to do this:
> if(!isset($var1)){ // is NOT declared?
>   $var1 = "";
> }
> if(!isset($var2)){ // is NOT declared?
>   $var2 = "";
> }
> // first we had to declare them, now we can use them
> if($var1 == "something"){
>   ...
> }
> if($var2 == "anything"){
>   ...
> }
> 
> 
> I wonder if this new behaviour is a bug or a feature?
> Or why can't I find info about it in the changes list if it's a feature?
> 
> Please send your answer to: [EMAIL PROTECTED]
> 
> Thank you!
> 
> Volker Puttrich
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
> Edit this bug report at http://bugs.php.net/?id=14296&edit=1
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to