svn: /phpdoc/en/trunk/reference/datetime/functions/ strftime.xml

From: Date: Mon, 20 Dec 2010 02:00:39 +0000
Subject: svn: /phpdoc/en/trunk/reference/datetime/functions/ strftime.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7549@lists.php.net to get a copy of this message
kalle Mon, 20 Dec 2010 02:00:39 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=306482 Log: Improved example #3 (%e modifier on Windows) - Patch by simon at stienen dot name (bug #53558) Bugs: http://bugs.php.net/3 (Closed) extern for errno missing in debugger.c http://bugs.php.net/53558 (Open) PHP manual; strftime: Example #3 is not location aware. Changed paths: U phpdoc/en/trunk/reference/datetime/functions/strftime.xml Modified: phpdoc/en/trunk/reference/datetime/functions/strftime.xml =================================================================== --- phpdoc/en/trunk/reference/datetime/functions/strftime.xml 2010-12-20 01:46:12 UTC (rev 306481) +++ phpdoc/en/trunk/reference/datetime/functions/strftime.xml 2010-12-20 02:00:39 UTC (rev 306482) @@ -460,17 +460,18 @@ </para> <para> <example> - <title>Cross platform compatible example using the %e modifier</title> + <title>Cross platform compatible example using the <literal>%e</literal> modifier</title> <programlisting role="php"> <![CDATA[ <?php -$format = '%e'; +// Jan 1: results in: '%e%1%' (%%, e, %%, %e, %%) +$format = '%%e%%%e%%'; -// Check for Windows and only attempt to replace -// the %e modifiers if they exists in the format -if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && strpos($format, '%e') !== false) { - $format = str_replace('%e', '%#d', $format); +// Check for Windows to find and replace the %e +// modifier correctly +if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { + $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); } echo strftime($format);

« previous php.doc.cvs (#7549) next »