Jump to content

[SOLVED] Can I use regex to make this more compact?


revraz

Recommended Posts

Can I use a replace function to make this better?

 

$rdate = "12/31/2007-14:00";

$rdate = str_replace ("-", "", $rdate);
$rdate = str_replace ("/", "", $rdate);
$rdate = str_replace (":", "", $rdate);

echo $rdate; //123120071400

 

I basically want to strip everything non numeric and get a 12 digit number.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.