mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@306482 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
8ff6a10616
commit
38b8faf180
1 changed files with 7 additions and 6 deletions
|
@ -460,17 +460,18 @@ echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n
|
|||
</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);
|
||||
|
|
Loading…
Reference in a new issue