$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
?
preg_split('/[\/\-\\]/', $date);
^escaping the closing ']'
あいまいさを取り除くために、代わりに次のことを行います
preg_split('/[\/\-\\\\]/', $date);
エスケープする必要はありませんが、同様に-
使用できます。\-
コード:
$date = 'as\sad-s/p';
$slices = preg_split('/[\/\-\\\\]/', $date);
print_r($slices);
出力:
Array ( [0] => as [1] => sad [2] => s [3] => p )