thealexangroup Posted February 22, 2014 Share Posted February 22, 2014 ERROR: Deprecated: Function split() is deprecated in... /adminPage.php on line 262 how would code look when (if) replaced with "explode" 260 <?261 if($dtime){262 $m=split('[-," "]',$dtime);263 $s=date("jS F Y", mktime(0, 0, 0, $m[1], $m[2], $m[0]));264 } thanx in advance, a Link to comment https://forums.phpfreaks.com/topic/286418-deprecated-function-split-is-deprecated-in/ Share on other sites More sharing options...
jonsjava Posted February 22, 2014 Share Posted February 22, 2014 The right tool for the job. In this case, it would be preg_split, not explode. Explode only handles one dilimiter. <? if($dtime){ $m=preg_split("/ (-|\s|) /",$dtime); $s=date("jS F Y", mktime(0, 0, 0, $m[1], $m[2], $m[0])); } Link to comment https://forums.phpfreaks.com/topic/286418-deprecated-function-split-is-deprecated-in/#findComment-1470068 Share on other sites More sharing options...
thealexangroup Posted February 22, 2014 Author Share Posted February 22, 2014 thanx for responding. ahhh. preg_split. code worked awesomely with minor change on line 263 $m=preg_split("/[\- ]/",$dtime); help much appreciated. cheerz! Link to comment https://forums.phpfreaks.com/topic/286418-deprecated-function-split-is-deprecated-in/#findComment-1470073 Share on other sites More sharing options...
Augury Posted February 22, 2014 Share Posted February 22, 2014 "/ (-|\s|) /" Are the spaces for readability or is this not "/(-|\s|)/" ? I don't like "sed" myself because it does not meet my immediate needs. Stream editing: apples are apples, oranges are oranges. The underling concept is there. I always choose rpl over sed day to day because sed is so prone to miss firing. Besides this the numerous variations of regexp which will accomplish quite the same objective is trivial functionality at best. Not precisely hamfisted but I can read '[-," "]' and I don't see any clever ways to disguise just this. Link to comment https://forums.phpfreaks.com/topic/286418-deprecated-function-split-is-deprecated-in/#findComment-1470074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.