On Tue, April 17, 2007 4:40 pm, Jochem Maas wrote:
> Richard Lynch wrote:
>> On Mon, April 16, 2007 10:20 am, Tijnema ! wrote:
>>> And btw, I think it's better not to create a new link to the class
>>> each time the function is called, but just use ::
>>> if (!function_exists('json_encode')) {
>>>        function json_encode($data) {
>>>                return Services_JSON::encode($data);
>>>        }
>>> }
>>>
>>> and probably also one for decoding.
>>>
>>> if (!function_exists('json_decode')) {
>>>        function json_decode($data) {
>>>                return Services_JSON::decode($data);
>>>        }
>>> }
>>
>> Actually, if I understand the flame wars of Internals correctly,
>> whichever one of those is correct, the other one ain't gonna work in
>> PHP 6...
>
> which flamewar ... I've completely missed it ... or was a while back?
> and what exactly is 'those' referring to in that last comment?

It's awhile back, and it's about whether you can call a static
function as if it were a method or not.

So only one of these is "kosher"
static:
return Services_JSON::decode($data);

class:
$json = new Services_JSON;
return $json->decode($data);

but not both.


>> Or so I gather from the OOP purists fighting the OOP zealots on
>> PHP-Internals.
>
> isn't a purist and a zealot the same in this context? aren't they both
> trying to slay the OOP pragmatists?
>
> (makes you want to say 'oops' don't you think ;-)

I meant what I said and I said what I meant.

It's up to you to figure it out. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

Reply via email to