Using split on PHP 5.3.0

It’s been a while since it started coding again in PHP specially in PHP 5.3.0 and I’ve come across some interesting finding, for example some functions such as ereg, eregi and split are deprecated now in favor of a new library call Perl-Compatible Regular Expressions. For old coders (like me) we need to start updating our code to keep with the up to date standards.

A function I use a lot (for good or for bad) is split but as a matter of fact is one of the new deprecated functions on php so instead of calling it as usual (delimiter, string) now we have to call it using a perl-compatible regular expression (regex,string) as follows:

$email = “”;

$parts = preg_split(‘/@/’,$email);


Array ( [0] => something [1] => )

You can see it’s the same result as the old split() function.

Hope this saves you some time.

One thought on “Using split on PHP 5.3.0

  1. Keep a footprint of every one only thing happening which will help to attract vital trade for purchasing. Just rebuff who all visits sites and spends time on which serving-boy.Also consider the footing they selected to make purchases. This will help in gaining information about the interests of customers to get ready them exactly what they want.

Leave a Reply

Your email address will not be published. Required fields are marked *