PDA

View Full Version : Dashes with PRCE (PHP)



Phlashman
December 1st, 2005, 11:03 PM
Hi! I'm trying to use PRCE (preg_split) to split up a date string and make it a date object and all. I was originally using this as the search pattern on my local machine:
<[/|:|\p{Pd}| ]>
However, I tried to bring it online, and it did not work. Specifically, the \p{Pd} that signifies a dash, which is very important, as MySQL returns a date with dashes to separate.

With further research, I found that those PRCE functions or whatever were added in v4.4.0, and I have v4.3.0. This is not my server we're talking about, so we can't update it.

Is there any other way to use a dash with PRCE than the \p thing?

Thanks for the help.

EDIT: Pretend the :| is really a : and a | right next to each other ;).

Ankou
December 2nd, 2005, 03:18 PM
You just want to break a part a date string from mysql (something like "2005-12-02")?

$date = "2005-12-02"; // Or however you get the date
list($year, $month, $day) = explode("-", $date);