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

x
?
Solved

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

Posted on 2009-12-23
5
Medium Priority
?
1,136 Views
Last Modified: 2013-12-13
Hi,

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?

Thanks
0
Comment
Question by:TURBOSHAN
5 Comments
 
LVL 34

Accepted Solution

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

http://uk2.php.net/manual/en/function.preg-split.php

0
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 124 total points
ID: 26114462
Hello TURBOSHAN,

str_split ?
http://www.php.net/manual/en/function.str-split.php

Regards.
0
 
LVL 35

Assisted Solution

by:gr8gonzo
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()
0
 
LVL 18

Assisted Solution

by:Hube02
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.
0
 
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:
http://us3.php.net/manual/en/function.split.php

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
0

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