frondo Posted June 3, 2012 Share Posted June 3, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/263560-deprecated-function-split/ Share on other sites More sharing options...
requinix Posted June 3, 2012 Share Posted June 3, 2012 If it actually doesn't work then there's something else wrong. But I think by "doesn't work" you really mean "it does work but I get a warning message". explode("|", $line, 5) explode("_", $ID, 3) explode("|", $line, 5) Quote Link to comment https://forums.phpfreaks.com/topic/263560-deprecated-function-split/#findComment-1350702 Share on other sites More sharing options...
frondo Posted June 3, 2012 Author Share Posted June 3, 2012 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 . . . Quote Link to comment https://forums.phpfreaks.com/topic/263560-deprecated-function-split/#findComment-1350752 Share on other sites More sharing options...
requinix Posted June 3, 2012 Share Posted June 3, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/263560-deprecated-function-split/#findComment-1350793 Share on other sites More sharing options...
frondo Posted June 3, 2012 Author Share Posted June 3, 2012 I feel much better after this little na-p na-p 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 Quote Link to comment https://forums.phpfreaks.com/topic/263560-deprecated-function-split/#findComment-1350807 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.