RE: [PHP] Hide the undefined offset error for the array?

From: Date: Tue, 30 Jul 2002 16:42:07 +0000
Subject: RE: [PHP] Hide the undefined offset error for the array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110371@lists.php.net to get a copy of this message
> I have one of the website on windows and I get the undefined offset error, > I > don't have that problem on UNIX / Linux. Anyone know what method would > work?? Here's the script! In this case, the $raw_data array is empty, so > window complain of the empty data by displaying hte error message, > "Undefined offset ........". > > --clip-- > if ($raw_data[$num_count] != $match_array[$x]) { > --clip-- It's now a Windows/Unix thing...your installations of PHP have different error reporting levels set in PHP.ini. So, either change the error reporting in PHP.ini or with the error_reporting() function, hide the warning by using @, or check and make sure the variable exists before you use it. if(@$raw_data[$num_count] != $match_array[$x]) or... if(isset($raw_data[$num_count]) && $raw_data[$num_count] != $match_array[$x]) Hmm...what are you doing, btw? Are you use you couldn't make use of in_array()?? ---John Holmes...

« previous php.general (#110371) next »