Re: Undefined Index Errors

From: Date: Fri, 06 Feb 2004 16:05:34 +0000
Subject: Re: Undefined Index Errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177024@lists.php.net to get a copy of this message
On Fri, 2004-02-06 at 10:51, Cameron B. Prince wrote: > I'm creating some strings from array elements obviously. The issue is, the > array elements don't always exist depending on which function you are > running. And when they don't, the server log is full of undefined index > errors. Is there a way I can avoid these errors without adding a > "if(isset(...))" around each one? If you know which variables are required per 'function' that is being called wrap an if around these variable declarations in blocks. You will still have ifs, but you should have a lot fewer. If by function you mean actual functions then you could move these lines to the top of their respective functions. -- Adam Bregenzer adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#177024) next »