On 9/30/07, 潘志彬 <ryu.pan@xxxxxxxxx> wrote: > > $dbh = 'test'; > > class search_helper extends AjaxACApplication > { > /** > * Database connection details > */ > > // announce global variable before use it > global $dbh; > > $db_hostname = $dbh; global variables inside a class ?? as Martin said this is a bad practice. if you were going to use a global variable inside a class, why bother w/ a class in the first place? the point is to encapsulate, ie. hide implementation details from the user. by relying on a global variable, the class is open to behavior modification by external code that does not have to go through its well-defined public interface to do so. thats why its a bad practice. -nathan