Re: Globally accessible objects without using 'global $obj;'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris W. Parker wrote:
What I'd ultimately like to do is be able to return more than just a
true/false from a function regarding it's end state. For example, a
function could fail for multiple reasons and just returning a plain
false for all situations does not suffice.

You could either return an object like PEAR_Error (http://pear.php.net/manual/en/core.pear.pear-error.php) or use a more customizable solution like PEAR_ErrorStack (http://pear.php.net/manual/en/core.pear.pear-errorstack.php). Also, don't forget about built-in options like trigger_error and Exceptions in php5.


More important than what you use is planning for future growth. Your applications will get larger. It may seem like a time-saver to do a quickie fix that requires less initial typing, but I guarantee you will run into a brick wall when you do have to change things and be forced to rewrite everything - not exactly a timesaver, unless you simply give up on making your code better :)

Greg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux