Edit report at https://bugs.php.net/bug.php?id=63928&edit=1

 ID:                 63928
 Updated by:         [email protected]
 Reported by:        Mikayuoads at gmail dot com
 Summary:            unexpected behaviour of sprintf
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   Gentoo
 PHP Version:        5.4.10
 Block user comment: N
 Private report:     N

 New Comment:

The sprintf() function specified for the C standard, and upon which PHP's 
function is based explicitly says that "[i]f the 0 and-flags both appear, the 0 
flag is ignored."

Implementing different behavior in PHP would be ill-advised.


Previous Comments:
------------------------------------------------------------------------
[2013-01-07 09:19:29] Mikayuoads at gmail dot com

Description:
------------
---
>From manual page: 
>http://www.php.net/function.sprintf#refsect1-function.sprintf-seealso
---

Right padding doesn't work with zeros.

Test script:
---------------
echo sprintf('%\'0-5d', 42); // output: '42   '
echo sprintf('%0-5d', 42); // output: '42   '
echo sprintf('%\'#-5d', 42); // output: '42###'

Expected result:
----------------
expected result:
echo sprintf('%\'0-5d', 42); // output: '42000'
echo sprintf('%0-5d', 42); // output: '42000'
echo sprintf('%\'#-5d', 42); // output: '42###'



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63928&edit=1

Reply via email to