[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Split is deprecated in PHP 5.3 - What can I use instead

Posted on 2009-12-23
Medium Priority
Last Modified: 2013-12-13

Still learning my way around PHP.  I'm using the PEAR XML-RPC to talk to a web service.  Just wrote my first client and when I test it, it runs fine, but throws the Split() function deprecated error.   I did a little research and I see that Split is disabled in PHP 6.  

So...If I wanted to change the RPC.php code to avoid using Split, what would be a good way to go?

Question by:TURBOSHAN
LVL 34

Accepted Solution

Beverley Portlock earned 128 total points
ID: 26114457
split() has been replaced by preg_split()


LVL 83

Assisted Solution

leakim971 earned 124 total points
ID: 26114462

str_split ?

LVL 35

Assisted Solution

gr8gonzo earned 124 total points
ID: 26114474
If you're splitting by a normal character or string (e.g. if you don't need regular expressions), then use explode()
LVL 18

Assisted Solution

Hube02 earned 124 total points
ID: 26114653
Split is part of the ereg family of functions and they are all removed as of PHP6, so you should make sure to replace these as well with the equivalent preg family function.

And like gr8gonzo said, if you're not actually using a regular expression to spit on you should be using explode(), it is much faster, it's always faster to use a simple string function than a regular expression function for simple things.
LVL 111

Expert Comment

by:Ray Paseur
ID: 26115022
You know about the PHP online manual, right?  See the first lightbulb tip on this page:

It's all there in black and white, along with many useful developer examples.  A really great learning resource!  All the functions are documented online - just a click away.

best regards, ~Ray

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month20 days, 5 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question