Re: [PHP] Static utility class?

2013-09-05 Thread Robert Cummings
On 13-09-04 09:06 PM, Micky Hulse wrote: Hi Rodrigo, thanks for the help, I really appreciate it! On Wed, Sep 4, 2013 at 5:55 PM, Rodrigo Santos rodrigos.santo...@gmail.com wrote: Hi, first, sorry for the bad English. Not bad at all! Very clear and well written reply (heck, it's better than

Re: [PHP] Static utility class?

2013-09-05 Thread Micky Hulse
On Wed, Sep 4, 2013 at 11:07 PM, Robert Cummings rob...@interjinn.com wrote: I'll second Rodrigo's opinion, but would like to comment that the name of the class is misleading since it's called Singleton. The singleton pattern is used when you only ever want one instantiation of a class. In your

Re: [PHP] Static utility class?

2013-09-05 Thread Micky Hulse
On Thu, Sep 5, 2013 at 12:15 PM, Robert Cummings rob...@interjinn.com wrote: Probably sufficient (and easier for typing) to just call it Utility since it follows the pattern but isn't the pattern itself :) Good call! Updated the example code. Thanks again! I really appreciate the help. :)

Re: [PHP] Static utility class?

2013-09-05 Thread Robert Cummings
On 13-09-05 02:27 PM, Micky Hulse wrote: On Wed, Sep 4, 2013 at 11:07 PM, Robert Cummings rob...@interjinn.com wrote: I'll second Rodrigo's opinion, but would like to comment that the name of the class is misleading since it's called Singleton. The singleton pattern is used when you only ever

[PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Hi all! Example code: https://gist.github.com/mhulse/6441525 Goal: I want to have a utility class that contain utility methods which should have the option of being called multiple times on a page. I think my main goal is to avoid having to new things ... I don't really need to create an

Re: [PHP] Static utility class?

2013-09-04 Thread Stephen
On 13-09-04 03:25 PM, Micky Hulse wrote: I want to have a utility class that contain utility methods which should have the option of being called multiple times on a page. This sounds simply like a library of functions that are implemented using objects. You can use the standard require_once

Re: [PHP] Static utility class?

2013-09-04 Thread David Harkness
On Wed, Sep 4, 2013 at 12:25 PM, Micky Hulse mickyhulse.li...@gmail.comwrote: I want to have a utility class that contain utility methods which should have the option of being called multiple times on a page. ... To put it another way, is there any reason why I would not want to use the

Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Thank you so much for the quick and very informative/educational replies Stephen and David, I really appreciate it! :) On Wed, Sep 4, 2013 at 12:36 PM, Stephen stephe...@rogers.com wrote: This sounds simply like a library of functions that are implemented using objects. Instantiate your static

Re: [PHP] Static utility class?

2013-09-04 Thread Stephen
On 13-09-04 05:09 PM, Micky Hulse wrote: Thank you so much for the quick and very informative/educational replies Stephen and David, I really appreciate it! :) On Wed, Sep 4, 2013 at 12:36 PM, Stephen stephe...@rogers.com wrote: This sounds simply like a library of functions that are

Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Thanks Stephen! I really appreciate the help! :) In my PHP ventures over the years, I haven't made much use of static variables/methods/properties ... I was thinking they might be useful for this one bit of code, but based on your feedback (and David's) I think I'll be heading down a different

Re: [PHP] Static utility class?

2013-09-04 Thread Rodrigo Santos
Hi, first, sorry for the bad English. Yes, at least, as far as I know, this is the perfect way to do what you want to do. Think like this: when you instanciate a class, you are allocating memory. If you don't need any information stored, then you don't need to allocate memory, right? So, it's is

Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Hi Rodrigo, thanks for the help, I really appreciate it! On Wed, Sep 4, 2013 at 5:55 PM, Rodrigo Santos rodrigos.santo...@gmail.com wrote: Hi, first, sorry for the bad English. Not bad at all! Very clear and well written reply (heck, it's better than my native English writing), so thank you! :)