[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: SV: [PROGRAMMERING] Cut eller grep i PHP



On Tue, 31 Aug 2004, Anders Gamborg wrote:

> Er det ikke lidt over kill ??

Om regulære udtryk, joh det var det nok i denne sammenhæng.

Men hvis datoen står midt i en tekststreng, så ser den sådan ud:

$echo = "Dags dato 3: 2004-08-21 hello world";
if (preg_match("/\d{4}-\d{2}-(\d{2})/", $echo, $match)) {
	$dag = $match[1];
}

Nemt ikke?

Man kan også lave et udtryk der checker om det er en valid dato,
men den bliver straks mere kompliceret. Specielt hvis den skal checke 
for skudår, men man kunne da checke for at måned ikke var større end 
12 og dag ikke større end 31.

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
Why do they call this a word processor?
It's simple. You've seen what food processors do to food, right?
					-- Skyler/Cosmo


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *