note 107442 deleted from function.printf by tularis

From: Date: Thu, 09 Feb 2012 13:44:01 +0000
Subject: note 107442 deleted from function.printf by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185939@lists.php.net to get a copy of this message
Note Submitter: rahulmaurya85 at gmail dot com ---- Printf Parameters format String that contains the text to be written to stdout. It can optionally contain embedded format tags that are substituted by the values specified in subsequent argument(s) and formatted as requested. The number of arguments following the format parameters should at least be as much as the number of format tags. The format tags follow this prototype: %[flags][width][.precision][length]specifier Where specifier is the most significant one and defines the type and the interpretation of the value of the coresponding argument: c = Character a d or i = Signed decimal integer =392 e =Scientific notation (mantissa/exponent) using e character =3.9265e+2 E =Scientific notation (mantissa/exponent) using E character =3.9265E+2 f=Decimal floating point 392.65 g=Use the shorter of %e or %f 392.65 G=Use the shorter of %E or %f 392.65 o=Unsigned octal 610 s=String of characters sample u=Unsigned decimal integer 7235 x=Unsigned hexadecimal integer 7fa X=Unsigned hexadecimal integer (capital letters) 7FA p=Pointer address B800:0000 n=Nothing printed. The argument must be a pointer to a signed int, where the number of characters written so far is stored. % A % followed by another % character will write % to stdout. % Emp. <?php $num = 1; printf ("Characters: %c %c \n", 'a', 65); printf ("Decimals: %d %ld\n", 1977, 650000); printf ("Preceding with blanks: %10d \n", 1977); printf ("Preceding with zeros: %010d \n", 1977); printf ("Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100); printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); printf ("Width trick: %*d \n", 5, 10); printf ("%s \n", "A string"); ?>

« previous php.notes (#185939) next »