|
 |
|
Oracle Database Tips by Donald Burleson
|
Now that the basics of PHP have been described,
useful functions used throughout this book can be revealed. This is in
listing form only without much explaining, as this is not a reference
book for PHP. The definition of the functions is taken from the PHP
on-line manual, without any change.
Outputs all parameters.
print ( string arg)
Outputs arg
Produces output according to format, described in
the online documentation for sprintf().
Returns a string produced according to the
formatting string format. The format string is composed of zero or
more directives: ordinary characters (excluding %) that are copied
directly to the result, and conversion specifications, each of which
results in fetching its own parameter. This applies to both sprintf()and printf().
Each conversion specification consists of a
percent sign (%) followed by one or more of these elements, in
order:
-
An optional sign specifierforces a sign (- or +) to be used on a number. By default, only the
- sign is used on a number if it is negative. This specifier forces
positive numbers to have the + sign attached as well and is added in
PHP 4.3.0.
-
An optional padding specifiersays what character will be used for padding the results to the right
string size. This may be a space character or a 0 (zero
character). The default is to pad with spaces. An alternate padding
character can be specified by prefixing it with a single quote (').
-
An optional alignment specifiersays if the result should be left-justified or right-justified. The
default is right-justified; a - character here will make it
left-justified.
-
An optional number, a width specifiersays how many characters (minimum) this conversion should result in.
-
An optional precision specifiersays how many decimal digits should be displayed for floating-point
numbers. When using this specifier on a string, it acts as a cutoff
point, setting a maximum character limit to the string.
-
A type specifiersays
what type the argument data should be treated as. Possible types:
-
% - a literal percent character. No argument is
required.
-
b - the argument is treated as an integer, and presented
as a binary number.
-
c - the argument is treated as an integer, and presented
as the character with that ASCII value.
-
d - the argument is treated as an integer, and presented
as a (signed) decimal number.
-
e - the argument is treated as scientific notation (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.
-
- the argument is treated as an integer, and presented
as an octal number.
-
s - the argument is treated as and presented as a
string.
-
x - the argument is treated as an integer and presented
as a hexadecimal number (with lowercase letters).
-
X - the argument is treated as an integer and presented
as a hexadecimal number (with uppercase letters).
See
code depot for complete scripts
This is an excerpt from the book
Easy Oracle PHP. You can get it
for more than 30% by buying it directly from the publisher and get
instant HTML-DB scripts from the code depot:
 |
Easy Oracle PHP
Create Dynamic Web Pages with Oracle Data
Includes online HTML-DB code depot
Buy it now for 30% off
- Only $19.95
|
HTML-DB support:
 |
For HTML-DB development support just call to gat an
Oracle Certified professional for all HTML-DB development
projects. |
|