01-27-2010, 08:15 PM
I am running PHP Version 5.2.9
I just noticed that there is a useful addition to the
the rtrim function that I want to use in 5.3.0.
Should I upgrade the PHP version on my server to %.3 ?
Is it fully stable ?
To go from .2 to .3 I guess there are some majors
improvements ? Maybe more ihe OOP side ?
Anyone using 5.3 ?
I use it on my dev box at home.
It seems stable. I haven't noticed any issues with it. (other than the escape character being the namespace delimiter) I do like some of the OOP improvements but haven't had much time to play with it yet since I do PHP at work all day and don't want to work when I get home.
01-27-2010, 10:45 PM
Namespaces rock. Chained with the spl_autoload method, you can then import with a simple:
use \Path\To\My\Package AS Package
Aside from that, I've noticed no instability issues. I've also not noticed any substantial upgrades in the OO environment, though one bug I've seen in an is_interface reporting has been corrected in PHP5.3.0.
What I have noticed is that reflection is more of a pain now. ReflectionClass expects a fully qualified name, so with namespaces you need to know what the namespace is in order to import it o.O. That I do not like, since it will not take out of current scope context - so if you have: use \Path\to\Package AS Package;, you cannot just do \ReflectionClass::export('Package');.
For you're dev box, definitely PHP5.3.0. If you do not have a supporting server, avoid the namespacing.
01-28-2010, 08:48 AM
Thanks for your input.
I won't upgrade yet as it is not for my dev server
and there is not an easy distro for it yet.
The reason it caught my eye was that I saw an upgrade to
rtrim() that I wanted to use (in the Manual).
What I have is a string like this:
"some-category => some-sub-cat"
The only static part of the string is the ' => '
and I want to split out the two parts so that I get,
"some-category" and "some-sub-cat".
What is the most efficient way to do this ?
01-28-2010, 12:12 PM
rtrim hasn't changed since 4.1.
The easiest way to split a string is to use the explode function.
$parts = explode(' => ', $strin);
// or split them and separate in one step:
list($cat, $subcat) = explode(' => ', $strin);