From 85cdaa2e89dba1dc709bd9da99d9b48b2fd58f6b Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Wed, 23 Oct 2013 08:31:48 +0000 Subject: [PATCH] #64371 fix alphabetical ordering of specifiers, add table for extra points concerning co-ercion git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@331922 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/strings/functions/sprintf.xml | 51 +++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/reference/strings/functions/sprintf.xml b/reference/strings/functions/sprintf.xml index 31659b69ca..00f9a644ea 100644 --- a/reference/strings/functions/sprintf.xml +++ b/reference/strings/functions/sprintf.xml @@ -117,10 +117,6 @@ E - like %e but uses uppercase letter (e.g. 1.2E+2). - - u - the argument is treated as an - integer, and presented as an unsigned decimal number. - f - the argument is treated as a float, and presented as a floating-point number (locale aware). @@ -146,6 +142,10 @@ s - the argument is treated as and presented as a string. + + u - the argument is treated as an + integer, and presented as an unsigned decimal number. + x - the argument is treated as an integer and presented as a hexadecimal number (with lowercase @@ -161,6 +161,49 @@ + + Variables will be co-erced to a suitable type for the specifier: + + Type Handling + + + + Type + Specifiers + + + + + string + s + + + long + + d, + u, + c, + o, + x, + X, + b + + + + double + + g, + G, + e, + E, + f, + F + + + + +
+
The format string supports argument numbering/swapping. Here is an example: