Jump to content

Deprecated function split


frondo

Recommended Posts

Hi, I have a one page/file script not working anymore except if I can downgrade php version, which I cannot.

I got this error:

Deprecated: Function split() is deprecated in /. . . ./index.php on line 354

Here are excerpt of all found split functions with lines number, first line being line 354 giving the error:

line 354 list($mID,$Title,$URL,$Desc,$PubDate) = split("\|", $line, 5);
line 80 list($mCrap,$mID,$DN) = split("\_", $ID, 3);
line99 list($mID,$Title,$URL,$Desc,$PubDate) = split("\|", $line, 5);

I'm not at all knowledgeable in php or programming and ask for help to solve what looks like an undecipherable maze for me.

Could someone shed an eye or even 2 eyes on it ?

I can add more code if you need so, I wrote the minimum to keep it short.

Thanks in advance for your time and help.

Link to comment
https://forums.phpfreaks.com/topic/263560-deprecated-function-split/
Share on other sites

It works ! ! ! :)

Until further testing, but it seems ok!

Thank you a bunch for your gurutic helping help ! ! !

 

>you really mean "it does work but I get a warning message".

You're right, and way more precise than I am . . . :-[

Before posting I did found and try explode and  preg_split without success . . .  :'(

 

I saw you changed split to explose and deleted \

That's why I had no results . . . :-\

 

I need to sleep now . . .  :P

 

 

Yes. split() uses regular expressions and a pipe | is a special character ("alternation") in one. Thus you have to escape it with a backslash \ to get a literal "pipe character".

explode() does not use regular expressions, which is great because you don't actually need them. Plain strings don't have concepts like "alternation" or "escaping"* so no backslash.

 

* I'm not talking about PHP's deal with singly- and doubly-quoted strings. I mean the characters within them, not their representation in code.

I feel much better after this little na-p na-p :D

 

Well, what can I say ?

I really appreciate your explanations about the code, I was not sure if asking for it in my post, wouldn't be too much, so I didn't.

And here they are, ta da.

Without even having to ask for.

That is perfect.

According that I might have been gifted enough, I only regret that I cannot learn about all this, because I'm sure I would have loved it, unfortunately time is what I have not enough.

Like most of us I suppose.

Anyway time to learn is not enough, lots and lots of experience is also needed, which also means a whole more of lots and lots of time . . .  :'(

I will never be able to do it . . .  :'(

 

That's why I say it again : THANK YOU requinix

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.