Log in

View Full Version : help in php



stephen64_14
02-08-2007, 03:40 PM
I have in a input text the following information:
Friday, February 9, 2007.

I want to extract of there on Friday.

I appreciate a prompt help...

:)

Twey
02-08-2007, 04:16 PM
function analizarFecha($fecha) {
$d = array(1 => 'día', 'mes', 'fecha', 'año');
$r = array();
$m = array();
preg_match('/(\w+), (\w+) (\d+), (\d+)/', $fecha, $m);
foreach($m as $k => $v)
if(isset($d[$k])) $r[$d[$k]] = $v;
return $r;
}

$fecha = analizarFecha($_GET['fecha']);
print $fecha['día']; // "Friday"

stephen64_14
02-08-2007, 04:32 PM
ok thank you for your help...