posts with the tag: namespace

Posted by: bob on Tuesday May 10th 2011 no comments
Tags: function, namespace, performance, php

To continue on with the previous post, On the speed of functions and namespaces, it was brought to my attention that namespaces should be faster with aliasing. Also how does it compare to static functions? The news was not good for either. Another thing that was brought to my attention that to avoid a lookup when in a namespace functions like filter_var should be absolute referenced, so we/I tried that too.

Continue reading to see the additional test

Posted by: bob on Tuesday May 10th 2011 2 comments
Tags: function, namespace, performance, php

My day started off fairly simple, I wanted to write a function that could take a string of things like “True” and “Yes” and return boolean true, thusly “False” and “No” would return me boolean false. PHP has a function that can handle the basics of this already, filter_var, however it only works on variants of true and false, not yes or no. Keeping with PHP’s strtolower and strtoupper naming I named this function strtobool and stuck it in my utility function namespace.

I then compared it speedwise to the built-in filter_var function, even though filter_var cannot do what I want at the scope I want it – it would still be a good test to see if it was even worth supporting “Yes” and “No”. Here are the results of that test.

Continue reading about the speed of PHP functions and namespaces

Posted by: bob on Wednesday May 4th 2011 no comments
Tags: coda, namespace, php

If you develop on a Mac, chances are you might have at least heard of Coda if not already fallen in love with it. It has been a while since they updated it, and I have submitted a few feature requests including Namespace support for the default PHP syntax mode. They mailed back thanking me and said it has been filed, but still no updates. So I decided yesterday to take matters into my own hands.

It could not be too difficult since they support third party syntax modes, but rather add a new PHP mode I wanted to edit the default one already configured. It was easy, and here is how I did it.

 

Continue Reading…