I am going crazy trying to figure out the correct regex pattern for a preg_split().
I tried using the examples on various pages but none of them worked.
I wish to split a string that by either a period (.) a slash (/) or a dash (-).
The input string in this case is 2014-10-15
The code that fails is:
$mmddyy = '10-31-2014';
$pattern = '[/.-]';
$arr = preg_split($pattern, $mmddyy);
$month = $arr;
$day = $arr;
$year = $arr;
mytrace("month=$month day=$day year=$year");
When mytrace displays the month day and year, it displays as:
month=10-31-2014 day= year=
So clearly the preg_split() regex syntax I am using is incorrect.
Can someone please put me out of my misery? :)