$date could be "23/09/2012" or "23-09-2012" or "23\09\2012"
preg_split('/[\/\-\\]/', $date);
Not sure why PHP keep throw missing terminating ] error
?
$date could be "23/09/2012" or "23-09-2012" or "23\09\2012"
preg_split('/[\/\-\\]/', $date);
Not sure why PHP keep throw missing terminating ] error
?
Do the following instead, to remove ambiguity
There is no need to escape
-
, but you could use\-
as well.Code:
Output: