hi, I want to replace the date with "0000-00-00" to " ". the code below replaces field regardless
of value. please advise. thanks
if (str_replace(array('0','-',':'),"000-00-00 00:00") == '')
Well, the str_replace() in your code will never work since you only give it 2 args, and it requires at least 3. However, putting that aside for the moment, it's not 100% clear to me what you are really trying to do, but I think maybe what you want is:
$row['duedate'] = preg_replace('/^[0:-]*$/', '', $row['duedate']);
What that does (unless I screwed up something): if $row['duedate'] only contains zeroes, colons, and/or hyphens (or is empty), then it is changed to an empty string.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)