diff --git a/reference/strings/functions/echo.xml b/reference/strings/functions/echo.xml
index 818ee0c9a8..7e2643f0b3 100644
--- a/reference/strings/functions/echo.xml
+++ b/reference/strings/functions/echo.xml
@@ -1,40 +1,40 @@
-
+
-
-
- echo
- Output one or more strings
-
-
- Description
-
- voidecho
- stringarg1
- string...
-
-
- Outputs all parameters.
-
-
- echo is not actually a function (it is a
- language construct), so you are not required to use parentheses
- with it. echo (unlike some other language
- constructs) does not behave like a function, so it cannot
- always be used in the context of a function. Additionally, if you want to
- pass more than one parameter to echo, the parameters
- must not be enclosed within parentheses.
-
-
-
- echo examples
-
+
+
+ echo
+ Output one or more strings
+
+
+ Description
+
+ voidecho
+ stringarg1
+ string...
+
+
+ Outputs all parameters.
+
+
+ echo is not actually a function (it is a
+ language construct), so you are not required to use parentheses
+ with it. echo (unlike some other language
+ constructs) does not behave like a function, so it cannot
+ always be used in the context of a function. Additionally, if you want to
+ pass more than one parameter to echo, the parameters
+ must not be enclosed within parentheses.
+
+
+
+ echo examples
+
]]>
-
-
-
-
- echo also has a shortcut syntax, where you can
- immediately follow the opening tag with an equals sign. This short syntax
- only works with the short_open_tag configuration setting
- enabled.
-
-
+
+
+
+
+ echo also has a shortcut syntax, where you can
+ immediately follow the opening tag with an equals sign. This short syntax
+ only works with the short_open_tag configuration setting
+ enabled.
+
+
foo.
]]>
-
-
-
-
- For a short discussion about the differences between
- print and echo, see this FAQTs
- Knowledge Base Article: &url.echo-print;
-
-
-
- ¬e.language-construct;
-
-
- See also
- print,
- printf, and
- flush.
-
-
-
+
+
+
+
+ For a short discussion about the differences between
+ print and echo, see this FAQTs
+ Knowledge Base Article: &url.echo-print;
+
+
+
+ ¬e.language-construct;
+
+
+ See also
+ print,
+ printf, and
+ flush.
+
+
+
+
-
-
- explode
- Split a string by string
-
-
- Description
-
- arrayexplode
- stringdelimiter
- stringstring
- intlimit
-
-
- Returns an array of strings, each of which is a substring of
- string formed by splitting it on
- boundaries formed by the string delimiter.
- If limit is set, the returned array will
- contain a maximum of limit elements with
- the last element containing the rest of
- string.
-
-
- If delimiter is an empty string (""),
- explode will return &false;. If
- delimiter contains a value that is not contained
- in string, then explode will
- return an array containing string.
-
-
- If the limit parameter is negative, all components
- except the last -limit are returned. This feature
- was added in PHP 5.1.0.
-
-
- Although implode can, for historical reasons,
- accept its parameters in either order,
- explode cannot. You must ensure that the
- delimiter argument comes before the
- string argument.
-
-
-
- The limit parameter was added in PHP
- 4.0.1
-
-
-
-
- explode examples
-
+
+
+ explode
+ Split a string by string
+
+
+ Description
+
+ arrayexplode
+ stringdelimiter
+ stringstring
+ intlimit
+
+
+ Returns an array of strings, each of which is a substring of
+ string formed by splitting it on
+ boundaries formed by the string delimiter.
+ If limit is set, the returned array will
+ contain a maximum of limit elements with
+ the last element containing the rest of
+ string.
+
+
+ If delimiter is an empty string (""),
+ explode will return &false;. If
+ delimiter contains a value that is not contained
+ in string, then explode will
+ return an array containing string.
+
+
+ If the limit parameter is negative, all components
+ except the last -limit are returned. This feature
+ was added in PHP 5.1.0.
+
+
+ Although implode can, for historical reasons,
+ accept its parameters in either order,
+ explode cannot. You must ensure that the
+ delimiter argument comes before the
+ string argument.
+
+
+
+ The limit parameter was added in PHP
+ 4.0.1
+
+
+
+
+ explode examples
+
]]>
-
-
-
-
-
- limit parameter examples
-
+
+
+
+
+
+ limit parameter examples
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
three
)
]]>
-
-
-
+
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also
- preg_split,
- str_split,
- strtok, and
- implode.
-
-
-
+
+ See also
+ preg_split,
+ str_split,
+ strtok, and
+ implode.
+
+
+
-
-
- fprintf
- Write a formatted string to a stream
-
-
- Description
-
- intfprintf
- resourcehandle
- stringformat
- mixedargs
- mixed...
-
-
- Write a string produced according to format
- to the stream resource specified by handle.
- format is described in the documentation for
- sprintf.
-
-
- Returns the length of the outputted string.
-
-
- See also: printf,
- sprintf,
- sscanf, fscanf,
- vsprintf, and
- number_format.
-
-
-
- Examples
-
-
- fprintf: zero-padded integers
-
+
+
+
+ fprintf
+ Write a formatted string to a stream
+
+
+ Description
+
+ intfprintf
+ resourcehandle
+ stringformat
+ mixedargs
+ mixed...
+
+
+ Write a string produced according to format
+ to the stream resource specified by handle.
+ format is described in the documentation for
+ sprintf.
+
+
+ Returns the length of the outputted string.
+
+
+ See also: printf,
+ sprintf,
+ sscanf, fscanf,
+ vsprintf, and
+ number_format.
+
+
+
+ Examples
+
+
+ fprintf: zero-padded integers
+
]]>
-
-
-
- fprintf: formatting currency
-
+
+
+
+ fprintf: formatting currency
+
]]>
-
-
-
-
-
+
+
+
+
+
+
-
-
- get_html_translation_table
-
- Returns the translation table used by
- htmlspecialchars and
- htmlentities
-
-
-
- Description
-
- arrayget_html_translation_table
- inttable
- intquote_style
-
-
- get_html_translation_table will return the
- translation table that is used internally for
- htmlspecialchars and
- htmlentities.
-
-
- There are two new constants
- (HTML_ENTITIES,
- HTML_SPECIALCHARS) that allow you to
- specify the table you want. Default value for table
- is HTML_SPECIALCHARS. And as in the
- htmlspecialchars and
- htmlentities functions you can optionally
- specify the quote_style you are working with. The default is
- ENT_COMPAT mode. See the description of these modes in
- htmlspecialchars.
-
-
-
- Special characters can be encoded in several ways. E.g.
- " can be encoded as ",
- " or ".
- get_html_translation_table returns only the most
- common form for them.
-
-
-
-
- Translation Table Example
-
+
+
+ get_html_translation_table
+ Returns the translation table used by htmlspecialchars and htmlentities
+
+
+ Description
+
+ arrayget_html_translation_table
+ inttable
+ intquote_style
+
+
+ get_html_translation_table will return the
+ translation table that is used internally for
+ htmlspecialchars and
+ htmlentities.
+
+
+ There are two new constants
+ (HTML_ENTITIES,
+ HTML_SPECIALCHARS) that allow you to
+ specify the table you want. Default value for table
+ is HTML_SPECIALCHARS. And as in the
+ htmlspecialchars and
+ htmlentities functions you can optionally
+ specify the quote_style you are working with. The default is
+ ENT_COMPAT mode. See the description of these modes in
+ htmlspecialchars.
+
+
+
+ Special characters can be encoded in several ways. E.g.
+ " can be encoded as ",
+ " or ".
+ get_html_translation_table returns only the most
+ common form for them.
+
+
+
+
+ Translation Table Example
+
& Kr
$encoded = strtr($str, $trans);
?>
]]>
-
-
- The $encoded variable will now contain:
- "Hallo & <Frau> &
- Krämer".
-
-
- See also htmlspecialchars,
- htmlentities, and
- html_entity_decode.
-
-
-
+
+
+ The $encoded variable will now contain:
+ "Hallo & <Frau> &
+ Krämer".
+
+
+ See also htmlspecialchars,
+ htmlentities, and
+ html_entity_decode.
+
+
+
+
-
-
- hebrev
-
- Convert logical Hebrew text to visual text
-
-
-
- Description
-
- stringhebrev
- stringhebrew_text
- intmax_chars_per_line
-
-
- The optional parameter max_chars_per_line
- indicates maximum number of characters per line that will be
- returned. The function tries to avoid breaking words.
-
-
- See also hebrevc
-
-
-
+
+
+ hebrev
+ Convert logical Hebrew text to visual text
+
+
+ Description
+
+ stringhebrev
+ stringhebrew_text
+ intmax_chars_per_line
+
+
+ The optional parameter max_chars_per_line
+ indicates maximum number of characters per line that will be
+ returned. The function tries to avoid breaking words.
+
+
+ See also hebrevc
+
+
+
+
-
-
- hebrevc
-
- Convert logical Hebrew text to visual text with newline conversion
-
-
-
- Description
-
- stringhebrevc
- stringhebrew_text
- intmax_chars_per_line
-
-
- This function is similar to hebrev with the
- difference that it converts newlines (\n) to "<br>\n". The
- optional parameter max_chars_per_line
- indicates maximum number of characters per line that will be
- returned. The function tries to avoid breaking words.
-
-
- See also hebrev
-
-
-
+
+
+ hebrevc
+ Convert logical Hebrew text to visual text with newline conversion
+
+
+ Description
+
+ stringhebrevc
+ stringhebrew_text
+ intmax_chars_per_line
+
+
+ This function is similar to hebrev with the
+ difference that it converts newlines (\n) to "<br>\n". The
+ optional parameter max_chars_per_line
+ indicates maximum number of characters per line that will be
+ returned. The function tries to avoid breaking words.
+
+
+ See also hebrev
+
+
+
+
-
-
- html_entity_decode
-
- Convert all HTML entities to their applicable characters
-
-
-
- Description
-
- stringhtml_entity_decode
- stringstring
- intquote_style
- stringcharset
-
-
- html_entity_decode is the opposite of
- htmlentities in that it converts all HTML entities
- to their applicable characters from string.
-
-
- The optional second quote_style parameter lets
- you define what will be done with 'single' and "double" quotes. It takes
- on one of three constants with the default being
- ENT_COMPAT:
-
- Available quote_style constants
-
-
-
- Constant Name
- Description
-
-
-
-
- ENT_COMPAT
- Will convert double-quotes and leave single-quotes alone.
-
-
- ENT_QUOTES
- Will convert both double and single quotes.
-
-
- ENT_NOQUOTES
- Will leave both double and single quotes unconverted.
-
-
-
-
-
-
- The ISO-8859-1 character set is used as default for the optional third
- charset. This defines the character set used in
- conversion.
-
- &reference.strings.charsets;
-
-
-
- This function doesn't support multi-byte character sets in PHP < 5.
-
-
-
- Decoding HTML entities
-
+
+
+ html_entity_decode
+ Convert all HTML entities to their applicable characters
+
+
+ Description
+
+ stringhtml_entity_decode
+ stringstring
+ intquote_style
+ stringcharset
+
+
+ html_entity_decode is the opposite of
+ htmlentities in that it converts all HTML entities
+ to their applicable characters from string.
+
+
+ The optional second quote_style parameter lets
+ you define what will be done with 'single' and "double" quotes. It takes
+ on one of three constants with the default being
+ ENT_COMPAT:
+
+ Available quote_style constants
+
+
+
+ Constant Name
+ Description
+
+
+
+
+ ENT_COMPAT
+ Will convert double-quotes and leave single-quotes alone.
+
+
+ ENT_QUOTES
+ Will convert both double and single quotes.
+
+
+ ENT_NOQUOTES
+ Will leave both double and single quotes unconverted.
+
+
+
+
+
+
+ The ISO-8859-1 character set is used as default for the optional third
+ charset. This defines the character set used in
+ conversion.
+
+ &reference.strings.charsets;
+
+
+
+ This function doesn't support multi-byte character sets in PHP < 5.
+
+
+
+ Decoding HTML entities
+
dog now";
@@ -81,7 +79,7 @@ echo $b; // I'll "walk" the dog now
// For users prior to PHP 4.3.0 you may do this:
-function unhtmlentities($string)
+function unhtmlentities($string)
{
// replace numeric entities
$string = preg_replace('~([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
@@ -98,28 +96,28 @@ echo $c; // I'll "walk" the dog now
?>
]]>
-
-
-
+
+
+
+
+
-
-
- You might wonder why trim(html_entity_decode(' ')); doesn't
- reduce the string to an empty string, that's because the ' '
- entity is not ASCII code 32 (which is stripped by
- trim) but ASCII code 160 (0xa0) in the default ISO
- 8859-1 characterset.
-
-
+ You might wonder why trim(html_entity_decode(' ')); doesn't
+ reduce the string to an empty string, that's because the ' '
+ entity is not ASCII code 32 (which is stripped by
+ trim) but ASCII code 160 (0xa0) in the default ISO
+ 8859-1 characterset.
-
- See also htmlentities,
- htmlspecialchars,
- get_html_translation_table,
- and urldecode.
-
-
-
+
+
+
+ See also htmlentities,
+ htmlspecialchars,
+ get_html_translation_table,
+ and urldecode.
+
+
+
+
-
-
- htmlentities
-
- Convert all applicable characters to HTML entities
-
-
-
- Description
-
- stringhtmlentities
- stringstring
- intquote_style
- stringcharset
- booldouble_encode
-
-
- This function is identical to
- htmlspecialchars in all ways, except with
- htmlentities, all characters which have HTML
- character entity equivalents are translated into these entities.
-
-
- Like htmlspecialchars, the optional second
- quote_style parameter lets you define what will
- be done with 'single' and "double" quotes. It takes on one of three
- constants with the default being ENT_COMPAT:
-
- Available quote_style constants
-
-
-
- Constant Name
- Description
-
-
-
-
- ENT_COMPAT
- Will convert double-quotes and leave single-quotes alone.
-
-
- ENT_QUOTES
- Will convert both double and single quotes.
-
-
- ENT_NOQUOTES
- Will leave both double and single quotes unconverted.
-
-
-
-
-
-
- Like htmlspecialchars, it takes an optional
- third argument charset which defines character
- set used in conversion.
- Presently, the ISO-8859-1 character set is used as the default.
-
- &reference.strings.charsets;
-
- When double_encode is turned off PHP will not
- encode existing html entities. The default is to convert everything.
-
- The double_quote parameter was added in PHP 5.2.3,
- charset in 4.1.0 and
- quote in PHP 4.0.3.
-
-
- If you're wanting to decode instead (the reverse) you can use
- html_entity_decode.
-
-
-
- A htmlentities example
-
+
+
+ htmlentities
+ Convert all applicable characters to HTML entities
+
+
+ Description
+
+ stringhtmlentities
+ stringstring
+ intquote_style
+ stringcharset
+ booldouble_encode
+
+
+ This function is identical to
+ htmlspecialchars in all ways, except with
+ htmlentities, all characters which have HTML
+ character entity equivalents are translated into these entities.
+
+
+ Like htmlspecialchars, the optional second
+ quote_style parameter lets you define what will
+ be done with 'single' and "double" quotes. It takes on one of three
+ constants with the default being ENT_COMPAT:
+
+ Available quote_style constants
+
+
+
+ Constant Name
+ Description
+
+
+
+
+ ENT_COMPAT
+ Will convert double-quotes and leave single-quotes alone.
+
+
+ ENT_QUOTES
+ Will convert both double and single quotes.
+
+
+ ENT_NOQUOTES
+ Will leave both double and single quotes unconverted.
+
+
+
+
+
+
+ Like htmlspecialchars, it takes an optional
+ third argument charset which defines character
+ set used in conversion.
+ Presently, the ISO-8859-1 character set is used as the default.
+
+ &reference.strings.charsets;
+
+ When double_encode is turned off PHP will not
+ encode existing html entities. The default is to convert everything.
+
+ The double_quote parameter was added in PHP 5.2.3,
+ charset in 4.1.0 and
+ quote in PHP 4.0.3.
+
+
+ If you're wanting to decode instead (the reverse) you can use
+ html_entity_decode.
+
+
+
+ A htmlentities example
+
bold";
@@ -88,17 +86,17 @@ echo htmlentities($str);
echo htmlentities($str, ENT_QUOTES);
?>
]]>
-
-
-
-
- See also html_entity_decode,
- get_html_translation_table,
- htmlspecialchars, nl2br,
- and urlencode.
-
-
-
+
+
+
+
+ See also html_entity_decode,
+ get_html_translation_table,
+ htmlspecialchars, nl2br,
+ and urlencode.
+
+
+
+
-
-
- implode
- Join array elements with a string
-
-
- Description
-
- stringimplode
- stringglue
- arraypieces
-
-
- Returns a string containing a string representation of all the
- array elements in the same order, with the glue string between
- each element.
-
- implode example
-
+
+
+ implode
+ Join array elements with a string
+
+
+ Description
+
+ stringimplode
+ stringglue
+ arraypieces
+
+
+ Returns a string containing a string representation of all the
+ array elements in the same order, with the glue string between
+ each element.
+
+ implode example
+
]]>
-
-
-
-
-
- implode can, for historical reasons, accept
- its parameters in either order. For consistency with
- explode, however, it may be less confusing
- to use the documented order of arguments.
-
-
-
-
- As of PHP 4.3.0, the glue parameter of implode is
- optional and defaults to the empty string(''). This is not the preferred
- usage of implode. We recommend to always use two
- parameters for compatibility with older versions.
-
-
+
+
+
+
+
+ implode can, for historical reasons, accept
+ its parameters in either order. For consistency with
+ explode, however, it may be less confusing
+ to use the documented order of arguments.
+
+
+
+
+ As of PHP 4.3.0, the glue parameter of implode is
+ optional and defaults to the empty string(''). This is not the preferred
+ usage of implode. We recommend to always use two
+ parameters for compatibility with older versions.
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also explode, and split.
-
-
-
+
+ See also explode, and split.
+
+
+
+
-
-
- localeconv
- Get numeric formatting information
-
-
- Description
-
- arraylocaleconv
-
-
-
- Returns an associative array containing localized numeric and
- monetary formatting information.
-
-
- localeconv returns data based upon the current locale
- as set by setlocale. The associative array that is
- returned contains the following fields:
-
-
-
-
- Array element
- Description
-
-
-
-
- decimal_point
- Decimal point character
-
-
- thousands_sep
- Thousands separator
-
-
- grouping
- Array containing numeric groupings
-
-
- int_curr_symbol
- International currency symbol (i.e. USD)
-
-
- currency_symbol
- Local currency symbol (i.e. $)
-
-
- mon_decimal_point
- Monetary decimal point character
-
-
- mon_thousands_sep
- Monetary thousands separator
-
-
- mon_grouping
- Array containing monetary groupings
-
-
- positive_sign
- Sign for positive values
-
-
- negative_sign
- Sign for negative values
-
-
- int_frac_digits
- International fractional digits
-
-
- frac_digits
- Local fractional digits
-
-
- p_cs_precedes
-
- &true; if currency_symbol precedes a positive value, &false;
- if it succeeds one
-
-
-
- p_sep_by_space
-
- &true; if a space separates currency_symbol from a positive
- value, &false; otherwise
-
-
-
- n_cs_precedes
-
- &true; if currency_symbol precedes a negative value, &false;
- if it succeeds one
-
-
-
- n_sep_by_space
-
- &true; if a space separates currency_symbol from a negative
- value, &false; otherwise
-
-
-
- p_sign_posn
-
-
- 0 - Parentheses surround the quantity and currency_symbol
- 1 - The sign string precedes the quantity and currency_symbol
- 2 - The sign string succeeds the quantity and currency_symbol
- 3 - The sign string immediately precedes the currency_symbol
- 4 - The sign string immediately succeeds the currency_symbol
-
-
-
-
- n_sign_posn
-
-
- 0 - Parentheses surround the quantity and currency_symbol
- 1 - The sign string precedes the quantity and currency_symbol
- 2 - The sign string succeeds the quantity and currency_symbol
- 3 - The sign string immediately precedes the currency_symbol
- 4 - The sign string immediately succeeds the currency_symbol
-
-
-
-
-
-
-
-
- The n_sign_posn, and n_sign_posn contain a string
- of formatting options. Each number representing one of the above listed conditions.
-
-
- The grouping fields contain arrays that define the way numbers should be
- grouped. For example, the monetary grouping field for the nl_NL locale (in
- UTF-8 mode with the euro sign), would contain a 2 item array with the
- values 3 and 3. The higher the index in the array, the farther left the
- grouping is. If an array element is equal to CHAR_MAX,
- no further grouping is done. If an array element is equal to 0, the previous
- element should be used.
-
-
- localeconv example
-
+
+
+ localeconv
+ Get numeric formatting information
+
+
+ Description
+
+ arraylocaleconv
+
+
+
+ Returns an associative array containing localized numeric and
+ monetary formatting information.
+
+
+ localeconv returns data based upon the current locale
+ as set by setlocale. The associative array that is
+ returned contains the following fields:
+
+
+
+
+ Array element
+ Description
+
+
+
+
+ decimal_point
+ Decimal point character
+
+
+ thousands_sep
+ Thousands separator
+
+
+ grouping
+ Array containing numeric groupings
+
+
+ int_curr_symbol
+ International currency symbol (i.e. USD)
+
+
+ currency_symbol
+ Local currency symbol (i.e. $)
+
+
+ mon_decimal_point
+ Monetary decimal point character
+
+
+ mon_thousands_sep
+ Monetary thousands separator
+
+
+ mon_grouping
+ Array containing monetary groupings
+
+
+ positive_sign
+ Sign for positive values
+
+
+ negative_sign
+ Sign for negative values
+
+
+ int_frac_digits
+ International fractional digits
+
+
+ frac_digits
+ Local fractional digits
+
+
+ p_cs_precedes
+
+ &true; if currency_symbol precedes a positive value, &false;
+ if it succeeds one
+
+
+
+ p_sep_by_space
+
+ &true; if a space separates currency_symbol from a positive
+ value, &false; otherwise
+
+
+
+ n_cs_precedes
+
+ &true; if currency_symbol precedes a negative value, &false;
+ if it succeeds one
+
+
+
+ n_sep_by_space
+
+ &true; if a space separates currency_symbol from a negative
+ value, &false; otherwise
+
+
+
+ p_sign_posn
+
+
+ 0 - Parentheses surround the quantity and currency_symbol
+ 1 - The sign string precedes the quantity and currency_symbol
+ 2 - The sign string succeeds the quantity and currency_symbol
+ 3 - The sign string immediately precedes the currency_symbol
+ 4 - The sign string immediately succeeds the currency_symbol
+
+
+
+
+ n_sign_posn
+
+
+ 0 - Parentheses surround the quantity and currency_symbol
+ 1 - The sign string precedes the quantity and currency_symbol
+ 2 - The sign string succeeds the quantity and currency_symbol
+ 3 - The sign string immediately precedes the currency_symbol
+ 4 - The sign string immediately succeeds the currency_symbol
+
+
+
+
+
+
+
+
+ The n_sign_posn, and n_sign_posn contain a string
+ of formatting options. Each number representing one of the above listed conditions.
+
+
+ The grouping fields contain arrays that define the way numbers should be
+ grouped. For example, the monetary grouping field for the nl_NL locale (in
+ UTF-8 mode with the euro sign), would contain a 2 item array with the
+ values 3 and 3. The higher the index in the array, the farther left the
+ grouping is. If an array element is equal to CHAR_MAX,
+ no further grouping is done. If an array element is equal to 0, the previous
+ element should be used.
+
+
+ localeconv example
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also setlocale.
-
-
-
+
+
+
+ See also setlocale.
+
+
+
+
-
-
- ltrim
-
- Strip whitespace (or other characters) from the beginning of a string
-
-
-
- Description
-
- stringltrim
- stringstr
- stringcharlist
-
-
+
+
+ ltrim
+ Strip whitespace (or other characters) from the beginning of a string
+
+
+ Description
+
+ stringltrim
+ stringstr
+ stringcharlist
+
+
+
+ The second parameter was added in PHP 4.1.0
+
+
+
+ This function returns a string with whitespace stripped from the
+ beginning of str.
+ Without the second parameter,
+ ltrim will strip these characters:
+
+
+
- The second parameter was added in PHP 4.1.0
+ " " (ASCII 32
+ (0x20)), an ordinary space.
-
-
- This function returns a string with whitespace stripped from the
- beginning of str.
- Without the second parameter,
- ltrim will strip these characters:
-
-
-
-
- " " (ASCII 32
- (0x20)), an ordinary space.
-
-
-
-
- "\t" (ASCII 9
- (0x09)), a tab.
-
-
-
-
- "\n" (ASCII 10
- (0x0A)), a new line (line feed).
-
-
-
-
- "\r" (ASCII 13
- (0x0D)), a carriage return.
-
-
-
-
- "\0" (ASCII 0
- (0x00)), the NUL-byte.
-
-
-
-
- "\x0B" (ASCII 11
- (0x0B)), a vertical tab.
-
-
-
-
-
- You can also specify the characters you want to strip, by means
- of the charlist parameter.
- Simply list all characters that you want to be stripped. With
- .. you can specify a range of characters.
-
-
- Usage example of ltrim
-
+
+
+
+ "\t" (ASCII 9
+ (0x09)), a tab.
+
+
+
+
+ "\n" (ASCII 10
+ (0x0A)), a new line (line feed).
+
+
+
+
+ "\r" (ASCII 13
+ (0x0D)), a carriage return.
+
+
+
+
+ "\0" (ASCII 0
+ (0x00)), the NUL-byte.
+
+
+
+
+ "\x0B" (ASCII 11
+ (0x0B)), a vertical tab.
+
+
+
+
+
+ You can also specify the characters you want to strip, by means
+ of the charlist parameter.
+ Simply list all characters that you want to be stripped. With
+ .. you can specify a range of characters.
+
+
+ Usage example of ltrim
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also trim and rtrim.
-
-
-
+
+
+
+ See also trim and rtrim.
+
+
+
+
-
-
- metaphone
- Calculate the metaphone key of a string
-
-
- Description
-
- stringmetaphone
- stringstr
- intphones
-
-
- Calculates the metaphone key of str.
-
-
- Similar to soundex metaphone creates the
- same key for similar sounding words. It's more accurate than
- soundex as it knows the basic rules of
- English pronunciation. The metaphone generated keys are of
- variable length.
-
-
-
- Metaphone was developed by Lawrence Philips
- <lphilips at verity dot com>. It is described in ["Practical
- Algorithms for Programmers", Binstock & Rex, Addison Wesley,
- 1995].
-
-
-
+
+
+ metaphone
+ Calculate the metaphone key of a string
+
+
+ Description
+
+ stringmetaphone
+ stringstr
+ intphones
+
+
+ Calculates the metaphone key of str.
+
+
+ Similar to soundex metaphone creates the
+ same key for similar sounding words. It's more accurate than
+ soundex as it knows the basic rules of
+ English pronunciation. The metaphone generated keys are of
+ variable length.
+
+
+
+ Metaphone was developed by Lawrence Philips
+ <lphilips at verity dot com>. It is described in ["Practical
+ Algorithms for Programmers", Binstock & Rex, Addison Wesley,
+ 1995].
+
+
+
+
-
-
- parse_str
- Parses the string into variables
-
-
- Description
-
- voidparse_str
- stringstr
- arrayarr
-
-
- Parses str as if it were the query string
- passed via a URL and sets variables in the current scope. If
- the second parameter arr is present,
- variables are stored in this variable as array elements instead.
-
-
-
- Support for the optional second parameter was added in PHP 4.0.3.
-
-
-
-
- To get the current QUERY_STRING, you may use the variable
- $_SERVER['QUERY_STRING'].
- Also, you may want to read the section on
- variables from outside of PHP.
-
-
-
-
- The magic_quotes_gpc setting
- affects the output of this function, as parse_str uses
- the same mechanism that PHP uses to populate the $_GET,
- $_POST, etc. variables.
-
-
-
-
- Using parse_str
-
+
+
+ parse_str
+ Parses the string into variables
+
+
+ Description
+
+ voidparse_str
+ stringstr
+ arrayarr
+
+
+ Parses str as if it were the query string
+ passed via a URL and sets variables in the current scope. If
+ the second parameter arr is present,
+ variables are stored in this variable as array elements instead.
+
+
+
+ Support for the optional second parameter was added in PHP 4.0.3.
+
+
+
+
+ To get the current QUERY_STRING, you may use the variable
+ $_SERVER['QUERY_STRING'].
+ Also, you may want to read the section on
+ variables from outside of PHP.
+
+
+
+
+ The magic_quotes_gpc setting
+ affects the output of this function, as parse_str uses
+ the same mechanism that PHP uses to populate the $_GET,
+ $_POST, etc. variables.
+
+
+
+
+ Using parse_str
+
]]>
-
-
-
-
- See also parse_url, pathinfo,
- http_build_query,
- get_magic_quotes_gpc, and urldecode.
-
-
-
+
+
+
+
+ See also parse_url, pathinfo,
+ http_build_query,
+ get_magic_quotes_gpc, and urldecode.
+
+
+
+
-
-
- printf
- Output a formatted string
-
-
- Description
-
- intprintf
- stringformat
- mixedargs
- mixed...
-
-
- Produces output according to format, which
- is described in the documentation for sprintf.
-
-
- Returns the length of the outputted string.
-
-
- See also
- print,
- sprintf,
- vprintf,
- sscanf,
- fscanf, and
- flush.
-
-
-
+
+
+ printf
+ Output a formatted string
+
+
+ Description
+
+ intprintf
+ stringformat
+ mixedargs
+ mixed...
+
+
+ Produces output according to format, which
+ is described in the documentation for sprintf.
+
+
+ Returns the length of the outputted string.
+
+
+ See also
+ print,
+ sprintf,
+ vprintf,
+ sscanf,
+ fscanf, and
+ flush.
+
+
+
+
-
-
- quoted_printable_decode
-
- Convert a quoted-printable string to an 8 bit string
-
-
-
- Description
-
- stringquoted_printable_decode
- stringstr
-
-
- This function returns an 8-bit binary string corresponding to the
- decoded quoted printable string (according to
- RFC2045, section 6.7, not
- RFC2821, section 4.5.2, so additional
- periods are not stripped from the beginning of line).
- This function is similar to
- imap_qprint, except this one does not
- require the IMAP module to work.
-
-
-
+
+
+ quoted_printable_decode
+ Convert a quoted-printable string to an 8 bit string
+
+
+ Description
+
+ stringquoted_printable_decode
+ stringstr
+
+
+ This function returns an 8-bit binary string corresponding to the
+ decoded quoted printable string (according to
+ RFC2045, section 6.7, not
+ RFC2821, section 4.5.2, so additional
+ periods are not stripped from the beginning of line).
+ This function is similar to
+ imap_qprint, except this one does not
+ require the IMAP module to work.
+
+
+
+
-
-
- quotemeta
- Quote meta characters
-
-
- Description
-
- stringquotemeta
- stringstr
-
-
- Returns a version of str with a backslash character
- (\) before every character that is among
- these: . \ + * ? [ ^ ] ( $ )
+
+
+ quotemeta
+ Quote meta characters
+
+
+ Description
+
+ stringquotemeta
+ stringstr
+
+
+ Returns a version of str with a backslash character
+ (\) before every character that is among
+ these: . \ + * ? [ ^ ] ( $ )
¬e.bin-safe;
@@ -23,8 +23,8 @@
See also addslashes,
addcslashes,
- htmlentities,
- htmlspecialchars,
+ htmlentities,
+ htmlspecialchars,
nl2br,
stripslashes, and
stripcslashes.
diff --git a/reference/strings/functions/rtrim.xml b/reference/strings/functions/rtrim.xml
index b8778cb8f8..6fd8d997e7 100644
--- a/reference/strings/functions/rtrim.xml
+++ b/reference/strings/functions/rtrim.xml
@@ -1,79 +1,77 @@
-
+
-
-
- rtrim
-
- Strip whitespace (or other characters) from the end of a string
-
-
-
- Description
-
- stringrtrim
- stringstr
- stringcharlist
-
-
+
+
+ rtrim
+ Strip whitespace (or other characters) from the end of a string
+
+
+ Description
+
+ stringrtrim
+ stringstr
+ stringcharlist
+
+
+
+ The second parameter was added in PHP 4.1.0
+
+
+
+ This function returns a string with whitespace stripped from the
+ end of str.
+ Without the second parameter,
+ rtrim will strip these characters:
+
+
+
- The second parameter was added in PHP 4.1.0
+ " " (ASCII 32
+ (0x20)), an ordinary space.
-
-
- This function returns a string with whitespace stripped from the
- end of str.
- Without the second parameter,
- rtrim will strip these characters:
-
-
-
-
- " " (ASCII 32
- (0x20)), an ordinary space.
-
-
-
-
- "\t" (ASCII 9
- (0x09)), a tab.
-
-
-
-
- "\n" (ASCII 10
- (0x0A)), a new line (line feed).
-
-
-
-
- "\r" (ASCII 13
- (0x0D)), a carriage return.
-
-
-
-
- "\0" (ASCII 0
- (0x00)), the NUL-byte.
-
-
-
-
- "\x0B" (ASCII 11
- (0x0B)), a vertical tab.
-
-
-
-
-
- You can also specify the characters you want to strip, by means
- of the charlist parameter.
- Simply list all characters that you want to be stripped. With
- .. you can specify a range of characters.
-
-
- Usage example of rtrim
-
+
+
+
+ "\t" (ASCII 9
+ (0x09)), a tab.
+
+
+
+
+ "\n" (ASCII 10
+ (0x0A)), a new line (line feed).
+
+
+
+
+ "\r" (ASCII 13
+ (0x0D)), a carriage return.
+
+
+
+
+ "\0" (ASCII 0
+ (0x00)), the NUL-byte.
+
+
+
+
+ "\x0B" (ASCII 11
+ (0x0B)), a vertical tab.
+
+
+
+
+
+ You can also specify the characters you want to strip, by means
+ of the charlist parameter.
+ Simply list all characters that you want to be stripped. With
+ .. you can specify a range of characters.
+
+
+ Usage example of rtrim
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also trim and ltrim.
-
-
-
+
+
+
+ See also trim and ltrim.
+
+
+
-
-
- sha1
- Calculate the sha1 hash of a string
-
-
- Description
-
- stringsha1
- stringstr
- boolraw_output
-
-
- Calculates the sha1 hash of str using the
- US Secure Hash Algorithm 1,
- and returns that hash. The hash is a 40-character hexadecimal number.
- If the optional raw_output is set to &true;,
- then the sha1 digest is instead returned in raw binary format with a
- length of 20.
-
-
-
- The optional raw_output parameter was added in
- PHP 5.0.0 and defaults to &false;
-
-
-
-
- A sha1 example
-
+
+
+
+ sha1
+ Calculate the sha1 hash of a string
+
+
+ Description
+
+ stringsha1
+ stringstr
+ boolraw_output
+
+
+ Calculates the sha1 hash of str using the
+ US Secure Hash Algorithm 1,
+ and returns that hash. The hash is a 40-character hexadecimal number.
+ If the optional raw_output is set to &true;,
+ then the sha1 digest is instead returned in raw binary format with a
+ length of 20.
+
+
+
+ The optional raw_output parameter was added in
+ PHP 5.0.0 and defaults to &false;
+
+
+
+
+ A sha1 example
+
]]>
-
-
-
-
- See also sha1_file,
- crc32, and
- md5
-
-
-
+
+
+
+
+ See also sha1_file,
+ crc32, and
+ md5
+
+
+
+
-
-
- similar_text
-
- Calculate the similarity between two strings
-
-
-
- Description
-
- intsimilar_text
- stringfirst
- stringsecond
- floatpercent
-
-
- This calculates the similarity between two strings as described
- in Oliver [1993]. Note that this implementation does not use a
- stack as in Oliver's pseudo code, but recursive calls which may
- or may not speed up the whole process. Note also that the
- complexity of this algorithm is O(N**3) where N is the length of
- the longest string.
-
-
- By passing a reference as third argument,
- similar_text will calculate the similarity
- in percent for you. It returns the number of matching chars in
- both strings.
-
-
- See also levenshtein, and soundex.
-
-
-
+
+
+ similar_text
+ Calculate the similarity between two strings
+
+
+ Description
+
+ intsimilar_text
+ stringfirst
+ stringsecond
+ floatpercent
+
+
+ This calculates the similarity between two strings as described
+ in Oliver [1993]. Note that this implementation does not use a
+ stack as in Oliver's pseudo code, but recursive calls which may
+ or may not speed up the whole process. Note also that the
+ complexity of this algorithm is O(N**3) where N is the length of
+ the longest string.
+
+
+ By passing a reference as third argument,
+ similar_text will calculate the similarity
+ in percent for you. It returns the number of matching chars in
+ both strings.
+
+
+ See also levenshtein, and soundex.
+
+
+
+
-
-
- soundex
- Calculate the soundex key of a string
-
-
- Description
-
- stringsoundex
- stringstr
-
-
- Calculates the soundex key of str.
-
-
- Soundex keys have the property that words pronounced similarly
- produce the same soundex key, and can thus be used to simplify
- searches in databases where you know the pronunciation but not
- the spelling. This soundex function returns a string 4 characters
- long, starting with a letter.
-
-
- This particular soundex function is one described by Donald Knuth
- in "The Art Of Computer Programming, vol. 3: Sorting And
- Searching", Addison-Wesley (1973), pp. 391-392.
-
-
-
- Soundex Examples
-
+
+
+ soundex
+ Calculate the soundex key of a string
+
+
+ Description
+
+ stringsoundex
+ stringstr
+
+
+ Calculates the soundex key of str.
+
+
+ Soundex keys have the property that words pronounced similarly
+ produce the same soundex key, and can thus be used to simplify
+ searches in databases where you know the pronunciation but not
+ the spelling. This soundex function returns a string 4 characters
+ long, starting with a letter.
+
+
+ This particular soundex function is one described by Donald Knuth
+ in "The Art Of Computer Programming, vol. 3: Sorting And
+ Searching", Addison-Wesley (1973), pp. 391-392.
+
+
+
+ Soundex Examples
+
]]>
-
-
-
-
- See also
- levenshtein,
- metaphone, and
- similar_text.
-
-
-
+
+
+
+
+ See also
+ levenshtein,
+ metaphone, and
+ similar_text.
+
+
+
+
-
-
- sprintf
- Return a formatted string
-
-
- Description
-
- stringsprintf
- stringformat
- mixedargs
- mixed...
-
-
- 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 specifier that forces a sign
- (- or +) to be used on a number. By default, only the - sign is used
- on a number if it's negative. This specifier forces positive numbers
- to have the + sign attached as well, and was added in PHP 4.3.0.
-
-
-
-
- An optional padding specifier that says
- 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 (').
- See the examples below.
-
-
-
-
- An optional alignment specifier that says
- 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 specifier
- that says how many characters (minimum) this conversion should
- result in.
-
-
-
-
- An optional precision specifier that says
- 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 specifier that says 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).
- The precision specifier stands for the number of digits after the
- decimal point since PHP 5.2.1. In earlier versions, it was taken as
- number of significant digits (one less).
-
-
- 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).
-
-
- F - the argument is treated as a
- float, and presented as a floating-point number (non-locale aware).
- Available since PHP 4.3.10 and PHP 5.0.3.
-
-
- o - 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).
-
-
-
-
-
-
-
- As of PHP 4.0.6 the format string supports argument
- numbering/swapping. Here is an example:
-
- Argument swapping
-
+
+
+ sprintf
+ Return a formatted string
+
+
+ Description
+
+ stringsprintf
+ stringformat
+ mixedargs
+ mixed...
+
+
+ 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 specifier that forces a sign
+ (- or +) to be used on a number. By default, only the - sign is used
+ on a number if it's negative. This specifier forces positive numbers
+ to have the + sign attached as well, and was added in PHP 4.3.0.
+
+
+
+
+ An optional padding specifier that says
+ 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 (').
+ See the examples below.
+
+
+
+
+ An optional alignment specifier that says
+ 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 specifier
+ that says how many characters (minimum) this conversion should
+ result in.
+
+
+
+
+ An optional precision specifier that says
+ 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 specifier that says 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).
+ The precision specifier stands for the number of digits after the
+ decimal point since PHP 5.2.1. In earlier versions, it was taken as
+ number of significant digits (one less).
+
+
+ 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).
+
+
+ F - the argument is treated as a
+ float, and presented as a floating-point number (non-locale aware).
+ Available since PHP 4.3.10 and PHP 5.0.3.
+
+
+ o - 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).
+
+
+
+
+
+
+
+ As of PHP 4.0.6 the format string supports argument
+ numbering/swapping. Here is an example:
+
+ Argument swapping
+
]]>
-
-
- This might output, "There are 5 monkeys in the tree". But
- imagine we are creating a format string in a separate file,
- commonly because we would like to internationalize it and we
- rewrite it as:
-
- Argument swapping
-
+
+
+ This might output, "There are 5 monkeys in the tree". But
+ imagine we are creating a format string in a separate file,
+ commonly because we would like to internationalize it and we
+ rewrite it as:
+
+ Argument swapping
+
]]>
-
-
- We now have a problem. The order of the placeholders in the
- format string does not match the order of the arguments in the
- code. We would like to leave the code as is and simply indicate
- in the format string which arguments the placeholders refer to.
- We would write the format string like this instead:
-
- Argument swapping
-
+
+
+ We now have a problem. The order of the placeholders in the
+ format string does not match the order of the arguments in the
+ code. We would like to leave the code as is and simply indicate
+ in the format string which arguments the placeholders refer to.
+ We would write the format string like this instead:
+
+ Argument swapping
+
]]>
-
-
- An added benefit here is that you can repeat the placeholders without
- adding more arguments in the code. For example:
-
- Argument swapping
-
+
+
+ An added benefit here is that you can repeat the placeholders without
+ adding more arguments in the code. For example:
+
+ Argument swapping
+
]]>
-
-
-
-
- See also printf,
- sscanf, fscanf,
- vsprintf, and
- number_format.
-
-
-
- Examples
-
- printf: various examples
-
+
+
+
+
+ See also printf,
+ sscanf, fscanf,
+ vsprintf, and
+ number_format.
+
+
+
+ Examples
+
+ printf: various examples
+
]]>
-
-
- The printout of this program would be:
-
-
+
+
+ The printout of this program would be:
+
+
-
-
-
- printf: string specifiers
-
+
+
+
+ printf: string specifiers
+
]]>
-
-
- The printout of this program would be:
-
-
+
+
+ The printout of this program would be:
+
+
-
-
-
- sprintf: zero-padded integers
-
+
+
+
+ sprintf: zero-padded integers
+
]]>
-
-
-
- sprintf: formatting currency
-
+
+
+
+ sprintf: formatting currency
+
]]>
-
-
-
- sprintf: scientific notation
-
+
+
+
+ sprintf: scientific notation
+
]]>
-
-
-
-
+
+
+
+
+
-
-
- str_ireplace
-
- Case-insensitive version of str_replace.
-
-
-
- Description
-
- mixedstr_ireplace
- mixedsearch
- mixedreplace
- mixedsubject
- intcount
-
-
- This function returns a string or an array with all occurrences of
- search in subject
- (ignoring case) replaced with the given replace
- value. If you don't need fancy replacing rules, you should generally
- use this function instead of eregi_replace or
- preg_replace with the i modifier.
-
-
- If subject is an array, then the search
- and replace is performed with every entry of
- subject, and the return value is an array
- as well.
-
-
- If search and
- replace are arrays, then
- str_ireplace takes a value from each array
- and uses them to do search and replace on
- subject. If
- replace has fewer values than
- search, then an empty string is used for
- the rest of replacement values. If search
- is an array and replace is a string; then
- this replacement string is used for every value of
- search.
-
-
-
- Every replacement with search array is performed
- on the result of previous replacement.
-
-
-
-
- str_ireplace example
-
+
+
+ str_ireplace
+ Case-insensitive version of str_replace.
+
+
+ Description
+
+ mixedstr_ireplace
+ mixedsearch
+ mixedreplace
+ mixedsubject
+ intcount
+
+
+ This function returns a string or an array with all occurrences of
+ search in subject
+ (ignoring case) replaced with the given replace
+ value. If you don't need fancy replacing rules, you should generally
+ use this function instead of eregi_replace or
+ preg_replace with the i modifier.
+
+
+ If subject is an array, then the search
+ and replace is performed with every entry of
+ subject, and the return value is an array
+ as well.
+
+
+ If search and
+ replace are arrays, then
+ str_ireplace takes a value from each array
+ and uses them to do search and replace on
+ subject. If
+ replace has fewer values than
+ search, then an empty string is used for
+ the rest of replacement values. If search
+ is an array and replace is a string; then
+ this replacement string is used for every value of
+ search.
+
+
+
+ Every replacement with search array is performed
+ on the result of previous replacement.
+
+
+
+
+ str_ireplace example
+
");
?>
]]>
-
-
-
-
- This function is binary safe.
-
-
-
- As of PHP 5.0.0 the number of matched and replaced
- needles will be returned in
- count which is passed by reference.
- Prior to PHP 5.0.0 this parameter is not available.
-
-
-
- See also:
- str_replace,
- preg_replace, and
- strtr.
-
-
-
+
+
+
+
+ This function is binary safe.
+
+
+
+ As of PHP 5.0.0 the number of matched and replaced
+ needles will be returned in
+ count which is passed by reference.
+ Prior to PHP 5.0.0 this parameter is not available.
+
+
+
+ See also:
+ str_replace,
+ preg_replace, and
+ strtr.
+
+
+
+
-
-
- str_pad
-
- Pad a string to a certain length with another string
-
-
-
- Description
-
- stringstr_pad
- stringinput
- intpad_length
- stringpad_string
- intpad_type
-
-
- This functions returns the input string
- padded on the left, the right, or both sides to the specified
- padding length. If the optional argument
- pad_string is not supplied, the
- input is padded with spaces, otherwise it
- is padded with characters from pad_string
- up to the limit.
-
-
- Optional argument pad_type can be
- STR_PAD_RIGHT, STR_PAD_LEFT,
- or STR_PAD_BOTH. If
- pad_type is not specified it is assumed to
- be STR_PAD_RIGHT.
-
-
- If the value of pad_length is negative or
- less than the length of the input string, no padding takes place.
-
-
-
- str_pad example
-
+
+
+ str_pad
+ Pad a string to a certain length with another string
+
+
+ Description
+
+ stringstr_pad
+ stringinput
+ intpad_length
+ stringpad_string
+ intpad_type
+
+
+ This functions returns the input string
+ padded on the left, the right, or both sides to the specified
+ padding length. If the optional argument
+ pad_string is not supplied, the
+ input is padded with spaces, otherwise it
+ is padded with characters from pad_string
+ up to the limit.
+
+
+ Optional argument pad_type can be
+ STR_PAD_RIGHT, STR_PAD_LEFT,
+ or STR_PAD_BOTH. If
+ pad_type is not specified it is assumed to
+ be STR_PAD_RIGHT.
+
+
+ If the value of pad_length is negative or
+ less than the length of the input string, no padding takes place.
+
+
+
+ str_pad example
+
]]>
-
-
-
-
-
- The pad_string may be truncated if the
- required number of padding characters can't be evenly divided by
- the pad_string's length.
-
-
-
-
+
+
+
+
+
+ The pad_string may be truncated if the
+ required number of padding characters can't be evenly divided by
+ the pad_string's length.
+
+
+
+
+
diff --git a/reference/strings/functions/str-rot13.xml b/reference/strings/functions/str-rot13.xml
index 33e728eb51..dc671627bd 100644
--- a/reference/strings/functions/str-rot13.xml
+++ b/reference/strings/functions/str-rot13.xml
@@ -1,29 +1,29 @@
-
+
-
-
- str_rot13
- Perform the rot13 transform on a string
-
-
- Description
-
- stringstr_rot13
- stringstr
-
-
- This function performs the ROT13 encoding on the
- str argument and returns the resulting
- string. The ROT13 encoding simply shifts every letter by 13
- places in the alphabet while leaving non-alpha characters
- untouched. Encoding and decoding are done by the same function,
- passing an encoded string as argument will return the original version.
-
-
-
- str_rot13 example
-
+
+
+ str_rot13
+ Perform the rot13 transform on a string
+
+
+ Description
+
+ stringstr_rot13
+ stringstr
+
+
+ This function performs the ROT13 encoding on the
+ str argument and returns the resulting
+ string. The ROT13 encoding simply shifts every letter by 13
+ places in the alphabet while leaving non-alpha characters
+ untouched. Encoding and decoding are done by the same function,
+ passing an encoded string as argument will return the original version.
+
+
+
+ str_rot13 example
+
]]>
-
-
-
-
-
- The behaviour of this function was buggy until PHP 4.3.0. Before
- this, the str was also modified, as if
- passed by reference.
-
-
-
-
+
+
+
+
+
+ The behaviour of this function was buggy until PHP 4.3.0. Before
+ this, the str was also modified, as if
+ passed by reference.
+
+
+
+
-
-
- str_split
-
- Convert a string to an array
-
-
-
- Description
-
- arraystr_split
- stringstring
- intsplit_length
-
-
- Converts a string to an array. If the optional
- split_length parameter is specified, the
- returned array will be broken down into chunks with each being
- split_length in length, otherwise each chunk
- will be one character in length.
-
-
- &false; is returned if split_length is less
- than 1. If the split_length length exceeds the
- length of string, the entire string is returned
- as the first (and only) array element.
-
-
-
- Example uses of str_split
-
+
+
+
+ str_split
+ Convert a string to an array
+
+
+ Description
+
+ arraystr_split
+ stringstring
+ intsplit_length
+
+
+ Converts a string to an array. If the optional
+ split_length parameter is specified, the
+ returned array will be broken down into chunks with each being
+ split_length in length, otherwise each chunk
+ will be one character in length.
+
+
+ &false; is returned if split_length is less
+ than 1. If the split_length length exceeds the
+ length of string, the entire string is returned
+ as the first (and only) array element.
+
+
+
+ Example uses of str_split
+
]]>
-
-
- Output may look like:
-
-
+
+
+ Output may look like:
+
+
Hel
- [1] => lo
+ [1] => lo
[2] => Fri
[3] => end
)
]]>
-
-
-
-
- See also chunk_split,
- preg_split,
- explode,
- count_chars,
- str_word_count, and
- for.
-
-
-
+
+
+
+
+ See also chunk_split,
+ preg_split,
+ explode,
+ count_chars,
+ str_word_count, and
+ for.
+
+
+
+
-
-
- strcasecmp
-
- Binary safe case-insensitive string comparison
-
-
-
- Description
-
- intstrcasecmp
- stringstr1
- stringstr2
-
-
- Returns < 0 if str1 is less than
- str2; > 0 if str1
- is greater than str2, and 0 if they are
- equal.
-
- strcasecmp example
-
+
+
+ strcasecmp
+ Binary safe case-insensitive string comparison
+
+
+ Description
+
+ intstrcasecmp
+ stringstr1
+ stringstr2
+
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if str1
+ is greater than str2, and 0 if they are
+ equal.
+
+ strcasecmp example
+
]]>
-
-
-
-
- See also
- preg_match,
- strcmp,
- substr,
- stristr,
- strncasecmp, and
- strstr.
-
-
-
+
+
+
+
+ See also
+ preg_match,
+ strcmp,
+ substr,
+ stristr,
+ strncasecmp, and
+ strstr.
+
+
+
+
-
-
- strcmp
- Binary safe string comparison
-
-
- Description
-
- intstrcmp
- stringstr1
- stringstr2
-
-
- Returns < 0 if str1 is less than
- str2; > 0 if str1
- is greater than str2, and 0 if they are
- equal.
-
-
- Note that this comparison is case sensitive.
-
-
- See also preg_match,
- strcasecmp,
- substr,
- stristr,
- strncasecmp,
- strncmp, and
- strstr.
-
-
-
+
+
+ strcmp
+ Binary safe string comparison
+
+
+ Description
+
+ intstrcmp
+ stringstr1
+ stringstr2
+
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if str1
+ is greater than str2, and 0 if they are
+ equal.
+
+
+ Note that this comparison is case sensitive.
+
+
+ See also preg_match,
+ strcasecmp,
+ substr,
+ stristr,
+ strncasecmp,
+ strncmp, and
+ strstr.
+
+
+
+
-
-
- strcoll
- Locale based string comparison
-
-
- Description
-
- intstrcoll
- stringstr1
- stringstr2
-
-
- Returns < 0 if str1 is less than
- str2; > 0 if
- str1 is greater than
- str2, and 0 if they are equal.
- strcoll uses the current locale for doing
- the comparisons. If the current locale is C or POSIX, this
- function is equivalent to strcmp.
-
-
- Note that this comparison is case sensitive, and unlike
- strcmp this function is not binary safe.
-
-
-
- strcoll was added in PHP 4.0.5, but was not enabled
- for win32 until 4.2.3.
-
-
-
- See also preg_match, strcmp,
- strcasecmp, substr,
- stristr, strncasecmp,
- strncmp, strstr, and
- setlocale.
-
-
-
+
+
+ strcoll
+ Locale based string comparison
+
+
+ Description
+
+ intstrcoll
+ stringstr1
+ stringstr2
+
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if
+ str1 is greater than
+ str2, and 0 if they are equal.
+ strcoll uses the current locale for doing
+ the comparisons. If the current locale is C or POSIX, this
+ function is equivalent to strcmp.
+
+
+ Note that this comparison is case sensitive, and unlike
+ strcmp this function is not binary safe.
+
+
+
+ strcoll was added in PHP 4.0.5, but was not enabled
+ for win32 until 4.2.3.
+
+
+
+ See also preg_match, strcmp,
+ strcasecmp, substr,
+ stristr, strncasecmp,
+ strncmp, strstr, and
+ setlocale.
+
+
+
+
-
-
- strcspn
-
- Find length of initial segment not matching mask
-
-
-
- Description
-
- intstrcspn
- stringstr1
- stringstr2
- intstart
- intlength
-
-
- Returns the length of the initial segment of
- str1 which does not
- contain any of the characters in str2.
-
-
- As of PHP 4.3.0, strcspn accepts two optional
- integer parameters that can be used to define the
- start position and the
- length of the string to examine.
-
+
+
+ strcspn
+ Find length of initial segment not matching mask
+
+
+ Description
+
+ intstrcspn
+ stringstr1
+ stringstr2
+ intstart
+ intlength
+
+
+ Returns the length of the initial segment of
+ str1 which does not
+ contain any of the characters in str2.
+
+
+ As of PHP 4.3.0, strcspn accepts two optional
+ integer parameters that can be used to define the
+ start position and the
+ length of the string to examine.
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strspn.
-
-
-
+
+ See also strspn.
+
+
+
+
-
-
- strip_tags
- Strip HTML and PHP tags from a string
-
-
- Description
-
- stringstrip_tags
- stringstr
- stringallowable_tags
-
+
+
+ strip_tags
+ Strip HTML and PHP tags from a string
+
+
+ Description
+
+ stringstrip_tags
+ stringstr
+ stringallowable_tags
+
+
+ This function tries to return a string with all HTML and PHP tags
+ stripped from a given str. It uses
+ the same tag stripping state machine as the
+ fgetss function.
+
+
+ You can use the optional second parameter to specify tags which
+ should not be stripped.
+
- This function tries to return a string with all HTML and PHP tags
- stripped from a given str. It uses
- the same tag stripping state machine as the
- fgetss function.
+ allowable_tags was added in PHP 3.0.13
+ and PHP 4.0.0.
- You can use the optional second parameter to specify tags which
- should not be stripped.
-
-
- allowable_tags was added in PHP 3.0.13
- and PHP 4.0.0.
-
-
- Since PHP 4.3.0, HTML comments are also stripped. This is hardcoded and can
- not be changed with allowable_tags.
-
-
-
-
- Because strip_tags does not actually validate the
- HTML, partial, or broken tags can result in the removal of more
- text/data than expected.
-
-
-
-
- This function does not modify any attributes on the tags that you allow
- using allowable_tags, including the
- style and onmouseover attributes
- that a mischievous user may abuse when posting text that will be shown
- to other users.
-
-
+ Since PHP 4.3.0, HTML comments are also stripped. This is hardcoded and can
+ not be changed with allowable_tags.
+
+
-
- strip_tags example
-
+ Because strip_tags does not actually validate the
+ HTML, partial, or broken tags can result in the removal of more
+ text/data than expected.
+
+
+
+
+ This function does not modify any attributes on the tags that you allow
+ using allowable_tags, including the
+ style and onmouseover attributes
+ that a mischievous user may abuse when posting text that will be shown
+ to other users.
+
+
+
+
+
+ strip_tags example
+
Test paragraph.
Other text
]]>
-
-
-
-
- strip_tags has been binary safe since PHP 5.0.0
-
-
- See also htmlspecialchars.
-
-
-
+
+
+
+
+ strip_tags has been binary safe since PHP 5.0.0
+
+
+ See also htmlspecialchars.
+
+
+
-
-
- stripos
-
- Find position of first occurrence of a case-insensitive string
-
-
-
- Description
-
- intstripos
- stringhaystack
- stringneedle
- intoffset
-
-
- Returns the numeric position of the first occurrence of
- needle in the haystack
- string. Unlike strpos,
- stripos is case-insensitive.
-
-
- Note that the needle may be a string of one or
- more characters.
-
-
- If needle is not found,
- stripos will return boolean &false;.
-
+
+
+
+ stripos
+ Find position of first occurrence of a case-insensitive string
+
+
+ Description
+
+ intstripos
+ stringhaystack
+ stringneedle
+ intoffset
+
+
+ Returns the numeric position of the first occurrence of
+ needle in the haystack
+ string. Unlike strpos,
+ stripos is case-insensitive.
+
+
+ Note that the needle may be a string of one or
+ more characters.
+
+
+ If needle is not found,
+ stripos will return boolean &false;.
+
- &return.falseproblem;
+ &return.falseproblem;
-
-
- stripos examples
-
+
+
+ stripos examples
+
]]>
-
-
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
-
- The optional offset parameter allows you
- to specify which character in haystack to
- start searching. The position returned is still relative to the
- beginning of haystack.
-
+
+
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+ The optional offset parameter allows you
+ to specify which character in haystack to
+ start searching. The position returned is still relative to the
+ beginning of haystack.
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strpos, strrpos,
- strrchr, substr,
- stristr, strstr,
- strripos and str_ireplace.
-
-
-
+
+ See also strpos, strrpos,
+ strrchr, substr,
+ stristr, strstr,
+ strripos and str_ireplace.
+
+
+
+
-
-
- stripslashes
-
- Un-quote string quoted with addslashes
-
-
-
- Description
-
- stringstripslashes
- stringstr
-
-
- Returns a string with backslashes stripped off.
- (\' becomes ' and so on.)
- Double backslashes (\\) are made into a single
- backslash (\).
-
-
-
- If magic_quotes_sybase is
- on, no backslashes are stripped off but two apostrophes are replaced by
- one instead.
-
-
-
- An example use of stripslashes is when the PHP
- directive magic_quotes_gpc
- is on (it's on by default), and you aren't inserting
- this data into a place (such as a database) that requires escaping.
- For example, if you're simply outputting data straight from an HTML
- form.
-
-
-
- A stripslashes example
-
+
+
+ stripslashes
+ Un-quote string quoted with addslashes
+
+
+ Description
+
+ stringstripslashes
+ stringstr
+
+
+ Returns a string with backslashes stripped off.
+ (\' becomes ' and so on.)
+ Double backslashes (\\) are made into a single
+ backslash (\).
+
+
+
+ If magic_quotes_sybase is
+ on, no backslashes are stripped off but two apostrophes are replaced by
+ one instead.
+
+
+
+ An example use of stripslashes is when the PHP
+ directive magic_quotes_gpc
+ is on (it's on by default), and you aren't inserting
+ this data into a place (such as a database) that requires escaping.
+ For example, if you're simply outputting data straight from an HTML
+ form.
+
+
+
+ A stripslashes example
+
]]>
-
-
-
-
-
- stripslashes is not recursive. If you want to apply
- this function to a mutli-dimensional array, you need to use a recursive function.
-
-
-
-
- Using stripslashes on an array
-
+
+
+
+
+
+ stripslashes is not recursive. If you want to apply
+ this function to a mutli-dimensional array, you need to use a recursive function.
+
+
+
+
+ Using stripslashes on an array
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
-
- For more information about "magic quotes", see get_magic_quotes_gpc.
-
-
- See also addslashes and
- get_magic_quotes_gpc.
-
-
-
+
+
+
+
+ For more information about "magic quotes", see get_magic_quotes_gpc.
+
+
+ See also addslashes and
+ get_magic_quotes_gpc.
+
+
+
+
-
-
- stristr
-
- Case-insensitive strstr
-
-
-
- Description
-
- stringstristr
- stringhaystack
- stringneedle
-
-
- Returns all of haystack from the first
- occurrence of needle to the end.
- needle and haystack
- are examined in a case-insensitive manner.
-
-
- If needle is not found, returns &false;.
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
-
-
- stristr example
-
+
+
+ stristr
+ Case-insensitive strstr
+
+
+ Description
+
+ stringstristr
+ stringhaystack
+ stringneedle
+
+
+ Returns all of haystack from the first
+ occurrence of needle to the end.
+ needle and haystack
+ are examined in a case-insensitive manner.
+
+
+ If needle is not found, returns &false;.
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+
+ stristr example
+
]]>
-
-
-
-
-
- Testing if a string is found or not
-
+
+
+
+
+
+ Testing if a string is found or not
+
]]>
-
-
-
-
-
- Using a non "string" needle
-
+
+
+
+
+
+ Using a non "string" needle
+
]]>
-
-
-
+
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also
- strstr,
- strrchr,
- substr, and
- preg_match.
-
-
-
+
+ See also
+ strstr,
+ strrchr,
+ substr, and
+ preg_match.
+
+
+
+
-
-
- strnatcasecmp
-
- Case insensitive string comparisons using a "natural order"
- algorithm
-
-
-
- Description
-
- intstrnatcasecmp
- stringstr1
- stringstr2
-
-
- This function implements a comparison algorithm that orders
- alphanumeric strings in the way a human being would. The
- behaviour of this function is similar to
- strnatcmp, except that the comparison is not
- case sensitive. For more information see: Martin Pool's Natural Order String Comparison
- page.
-
-
- Similar to other string comparison functions, this one returns
- < 0 if str1 is less than
- str2 > 0 if
- str1 is greater than
- str2, and 0 if they are equal.
-
-
- See also preg_match,
- strcasecmp,
- substr,
- stristr,
- strcmp,
- strncmp,
- strncasecmp,
- strnatcmp, and
- strstr.
-
-
-
+
+
+ strnatcasecmp
+ Case insensitive string comparisons using a "natural order" algorithm
+
+
+ Description
+
+ intstrnatcasecmp
+ stringstr1
+ stringstr2
+
+
+ This function implements a comparison algorithm that orders
+ alphanumeric strings in the way a human being would. The
+ behaviour of this function is similar to
+ strnatcmp, except that the comparison is not
+ case sensitive. For more information see: Martin Pool's Natural Order String Comparison
+ page.
+
+
+ Similar to other string comparison functions, this one returns
+ < 0 if str1 is less than
+ str2 > 0 if
+ str1 is greater than
+ str2, and 0 if they are equal.
+
+
+ See also preg_match,
+ strcasecmp,
+ substr,
+ stristr,
+ strcmp,
+ strncmp,
+ strncasecmp,
+ strnatcmp, and
+ strstr.
+
+
+
+
-
-
- strnatcmp
-
- String comparisons using a "natural order" algorithm
-
-
-
- Description
-
- intstrnatcmp
- stringstr1
- stringstr2
-
-
- This function implements a comparison algorithm that orders
- alphanumeric strings in the way a human being would, this is
- described as a "natural ordering". An example of the difference
- between this algorithm and the regular computer string sorting
- algorithms (used in strcmp) can be seen
- below:
-
-
+
+
+ strnatcmp
+ String comparisons using a "natural order" algorithm
+
+
+ Description
+
+ intstrnatcmp
+ stringstr1
+ stringstr2
+
+
+ This function implements a comparison algorithm that orders
+ alphanumeric strings in the way a human being would, this is
+ described as a "natural ordering". An example of the difference
+ between this algorithm and the regular computer string sorting
+ algorithms (used in strcmp) can be seen
+ below:
+
+
]]>
-
-
- The code above will generate the following output:
-
-
+
+
+ The code above will generate the following output:
+
+
img12.png
)
]]>
-
-
- For more information see: Martin Pool's Natural Order String Comparison
- page.
-
-
- Similar to other string comparison functions, this one returns
- < 0 if str1 is less than
- str2; > 0 if
- str1 is greater than
- str2, and 0 if they are equal.
-
-
- Note that this comparison is case sensitive.
-
-
- See also preg_match,
- strcasecmp, substr,
- stristr, strcmp,
- strncmp, strncasecmp,
- strnatcasecmp, strstr,
- natsort and natcasesort.
-
-
-
+
+
+ For more information see: Martin Pool's Natural Order String Comparison
+ page.
+
+
+ Similar to other string comparison functions, this one returns
+ < 0 if str1 is less than
+ str2; > 0 if
+ str1 is greater than
+ str2, and 0 if they are equal.
+
+
+ Note that this comparison is case sensitive.
+
+
+ See also preg_match,
+ strcasecmp, substr,
+ stristr, strcmp,
+ strncmp, strncasecmp,
+ strnatcasecmp, strstr,
+ natsort and natcasesort.
+
+
+
+
-
-
- strncasecmp
-
- Binary safe case-insensitive string comparison of the first n
- characters
-
-
-
- Description
-
- intstrncasecmp
- stringstr1
- stringstr2
- intlen
-
-
- This function is similar to strcasecmp, with
- the difference that you can specify the (upper limit of the)
- number of characters (len) from each
- string to be used in the comparison.
-
- Returns < 0 if str1 is less than
- str2; > 0 if str1
- is greater than str2, and 0 if they are
- equal.
-
-
- See also preg_match,
- strcasecmp,
- strcmp,
- substr,
- stristr, and
- strstr.
-
-
-
+
+
+ strncasecmp
+ Binary safe case-insensitive string comparison of the first n characters
+
+
+ Description
+
+ intstrncasecmp
+ stringstr1
+ stringstr2
+ intlen
+
+
+ This function is similar to strcasecmp, with
+ the difference that you can specify the (upper limit of the)
+ number of characters (len) from each
+ string to be used in the comparison.
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if str1
+ is greater than str2, and 0 if they are
+ equal.
+
+
+ See also preg_match,
+ strcasecmp,
+ strcmp,
+ substr,
+ stristr, and
+ strstr.
+
+
+
+
-
-
- strncmp
-
- Binary safe string comparison of the first n characters
-
-
-
- Description
-
- intstrncmp
- stringstr1
- stringstr2
- intlen
-
-
- This function is similar to strcmp, with the
- difference that you can specify the (upper limit of the) number
- of characters (len) from each string to be
- used in the comparison.
-
-
- Returns < 0 if str1 is less than
- str2; > 0 if str1
- is greater than str2, and 0 if they are
- equal.
-
-
- Note that this comparison is case sensitive.
-
-
- See also preg_match,
- strncasecmp,
- strcasecmp, substr,
- stristr, strcmp, and
- strstr.
-
-
-
+
+
+ strncmp
+ Binary safe string comparison of the first n characters
+
+
+ Description
+
+ intstrncmp
+ stringstr1
+ stringstr2
+ intlen
+
+
+ This function is similar to strcmp, with the
+ difference that you can specify the (upper limit of the) number
+ of characters (len) from each string to be
+ used in the comparison.
+
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if str1
+ is greater than str2, and 0 if they are
+ equal.
+
+
+ Note that this comparison is case sensitive.
+
+
+ See also preg_match,
+ strncasecmp,
+ strcasecmp, substr,
+ stristr, strcmp, and
+ strstr.
+
+
+
+
-
-
- strpos
-
- Find position of first occurrence of a string
-
-
-
- Description
-
- intstrpos
- stringhaystack
- mixedneedle
- intoffset
-
-
- Returns the numeric position of the first occurrence of
- needle in the
- haystack string. Unlike the
- strrpos before PHP 5, this function can take a full
- string as the needle parameter and the
- entire string will be used.
-
-
- If needle is not found,
- strpos will return boolean &false;.
-
-
- &return.falseproblem;
- ¬e.bin-safe;
-
-
- strpos examples
-
+
+
+ strpos
+ Find position of first occurrence of a string
+
+
+ Description
+
+ intstrpos
+ stringhaystack
+ mixedneedle
+ intoffset
+
+
+ Returns the numeric position of the first occurrence of
+ needle in the
+ haystack string. Unlike the
+ strrpos before PHP 5, this function can take a full
+ string as the needle parameter and the
+ entire string will be used.
+
+
+ If needle is not found,
+ strpos will return boolean &false;.
+
+
+ &return.falseproblem;
+ ¬e.bin-safe;
+
+
+ strpos examples
+
]]>
-
-
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
-
- The optional offset parameter allows you
- to specify which character in haystack to
- start searching. The position returned is still relative to the
- beginning of haystack.
-
-
- See also strrpos,
- stripos,
- strripos,
- strrchr,
- substr,
- stristr, and
- strstr.
-
-
-
+
+
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+ The optional offset parameter allows you
+ to specify which character in haystack to
+ start searching. The position returned is still relative to the
+ beginning of haystack.
+
+
+ See also strrpos,
+ stripos,
+ strripos,
+ strrchr,
+ substr,
+ stristr, and
+ strstr.
+
+
+
+
-
-
- strrchr
-
- Find the last occurrence of a character in a string
-
-
-
- Description
-
- stringstrrchr
- stringhaystack
- stringneedle
-
-
- This function returns the portion of
- haystack which starts at the last
- occurrence of needle and goes until the
- end of haystack.
-
-
- Returns &false; if needle is not found.
-
-
- If needle contains more than one
- character, only the first is used. This behavior is different from that
- of strchr.
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
- strrchr example
-
+
+
+ strrchr
+ Find the last occurrence of a character in a string
+
+
+ Description
+
+ stringstrrchr
+ stringhaystack
+ stringneedle
+
+
+ This function returns the portion of
+ haystack which starts at the last
+ occurrence of needle and goes until the
+ end of haystack.
+
+
+ Returns &false; if needle is not found.
+
+
+ If needle contains more than one
+ character, only the first is used. This behavior is different from that
+ of strchr.
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+ strrchr example
+
]]>
-
-
-
-
- strrchr has been binary safe since PHP 4.3.0
-
-
- See also strstr, substr, and
- stristr.
-
-
-
+
+
+
+
+ strrchr has been binary safe since PHP 4.3.0
+
+
+ See also strstr, substr, and
+ stristr.
+
+
+
-
-
- strripos
-
- Find position of last occurrence of a case-insensitive string in a string
-
-
-
- Description
-
- intstrripos
- stringhaystack
- stringneedle
- intoffset
-
-
- Returns the numeric position of the last occurrence of
- needle in the
- haystack string. Unlike
- strrpos, strripos is
- case-insensitive. Also note that string positions start at 0, and not
- 1.
-
-
- Note that the needle may be a string of one or
- more characters.
-
-
- If needle is not found, &false; is returned.
-
-
- &return.falseproblem;
-
-
-
- A simple strripos example
-
+
+
+
+ strripos
+ Find position of last occurrence of a case-insensitive string in a string
+
+
+ Description
+
+ intstrripos
+ stringhaystack
+ stringneedle
+ intoffset
+
+
+ Returns the numeric position of the last occurrence of
+ needle in the
+ haystack string. Unlike
+ strrpos, strripos is
+ case-insensitive. Also note that string positions start at 0, and not
+ 1.
+
+
+ Note that the needle may be a string of one or
+ more characters.
+
+
+ If needle is not found, &false; is returned.
+
+
+ &return.falseproblem;
+
+
+
+ A simple strripos example
+
]]>
-
-
- Outputs:
-
-
+
+
+ Outputs:
+
+
-
-
-
-
- The offset parameter may be specified to begin
- searching an arbitrary number of characters into the string.
-
-
- Negative offset values will start the search at
- offset characters from the
- start of the string.
-
-
- See also strrpos,
- strrchr,
- substr, stripos and
- stristr.
-
-
-
+
+
+
+
+ The offset parameter may be specified to begin
+ searching an arbitrary number of characters into the string.
+
+
+ Negative offset values will start the search at
+ offset characters from the
+ start of the string.
+
+
+ See also strrpos,
+ strrchr,
+ substr, stripos and
+ stristr.
+
+
+
+
-
-
- strrpos
-
- Find position of last occurrence of a char in a string
-
-
-
- Description
-
- intstrrpos
- stringhaystack
- stringneedle
- intoffset
-
-
- Returns the numeric position of the last occurrence of
- needle in the
- haystack string. Note that the needle in
- this case can only be a single character in PHP 4. If a string is passed
- as the needle, then only the first character of that string will
- be used.
-
-
- If needle is not found, returns &false;.
-
-
- It is easy to mistake the return values for "character found at
- position 0" and "character not found". Here's how to detect
- the difference:
-
-
+
+
+ strrpos
+ Find position of last occurrence of a char in a string
+
+
+ Description
+
+ intstrrpos
+ stringhaystack
+ stringneedle
+ intoffset
+
+
+ Returns the numeric position of the last occurrence of
+ needle in the
+ haystack string. Note that the needle in
+ this case can only be a single character in PHP 4. If a string is passed
+ as the needle, then only the first character of that string will
+ be used.
+
+
+ If needle is not found, returns &false;.
+
+
+ It is easy to mistake the return values for "character found at
+ position 0" and "character not found". Here's how to detect
+ the difference:
+
+
]]>
-
-
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
-
-
- As of PHP 5.0.0 offset may
- be specified to begin searching an arbitrary number of characters into
- the string. Negative values will stop searching at an arbitrary point
- prior to the end of the string.
-
-
-
-
- The needle may be a string of more than one
- character as of PHP 5.0.0.
-
-
-
- See also strpos,
- strripos,
- strrchr,
- substr,
- stristr, and
- strstr.
-
-
-
+
+
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+
+ As of PHP 5.0.0 offset may
+ be specified to begin searching an arbitrary number of characters into
+ the string. Negative values will stop searching at an arbitrary point
+ prior to the end of the string.
+
+
+
+
+ The needle may be a string of more than one
+ character as of PHP 5.0.0.
+
+
+
+ See also strpos,
+ strripos,
+ strrchr,
+ substr,
+ stristr, and
+ strstr.
+
+
+
+
-
-
- strspn
-
- Find length of initial segment matching mask
-
-
-
- Description
-
- intstrspn
- stringstr1
- stringstr2
- intstart
- intlength
-
-
- Returns the length of the initial segment of
- str1 which consists entirely of characters
- in str2.
-
-
- The line of code:
-
-
+
+
+ strspn
+ Find length of initial segment matching mask
+
+
+ Description
+
+ intstrspn
+ stringstr1
+ stringstr2
+ intstart
+ intlength
+
+
+ Returns the length of the initial segment of
+ str1 which consists entirely of characters
+ in str2.
+
+
+ The line of code:
+
+
]]>
-
-
- will assign 2 to $var, because the string "42" will
- be the longest segment containing characters from "1234567890".
-
-
- As of PHP 4.3.0, strspn accepts two optional
- integer parameters that can be used to define the
- start position and the
- length of the string to examine.
-
-
-
-
+
+
+ will assign 2 to $var, because the string "42" will
+ be the longest segment containing characters from "1234567890".
+
+
+ As of PHP 4.3.0, strspn accepts two optional
+ integer parameters that can be used to define the
+ start position and the
+ length of the string to examine.
+
+
+
+
]]>
-
-
-
+
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strcspn.
-
-
-
+
+ See also strcspn.
+
+
+
+
-
-
- strstr
- Find first occurrence of a string
-
-
- Description
-
- stringstrstr
- stringhaystack
- stringneedle
-
-
- Returns part of haystack string from the
- first occurrence of needle to the end of
- haystack.
-
-
- If needle is not found, returns &false;.
-
-
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
-
-
-
- This function is case-sensitive. For case-insensitive searches, use
- stristr.
-
-
-
-
- strstr example
-
+
+
+ strstr
+ Find first occurrence of a string
+
+
+ Description
+
+ stringstrstr
+ stringhaystack
+ stringneedle
+
+
+ Returns part of haystack string from the
+ first occurrence of needle to the end of
+ haystack.
+
+
+ If needle is not found, returns &false;.
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+
+ This function is case-sensitive. For case-insensitive searches, use
+ stristr.
+
+
+
+
+ strstr example
+
]]>
-
-
-
+
+
+
+
+
-
-
- If you only want to determine if a particular needle
- occurs within haystack, use the faster and less memory
- intensive function strpos instead.
-
-
+ If you only want to determine if a particular needle
+ occurs within haystack, use the faster and less memory
+ intensive function strpos instead.
-
- strstr has been binary safe since PHP 4.3.0
-
-
- See also preg_match,
- stristr, strpos,
- strrchr, and substr.
-
-
-
+
+
+
+ strstr has been binary safe since PHP 4.3.0
+
+
+ See also preg_match,
+ stristr, strpos,
+ strrchr, and substr.
+
+
+
+
-
-
- strtolower
- Make a string lowercase
-
-
- Description
-
- stringstrtolower
- stringstr
-
-
- Returns string with all alphabetic
- characters converted to lowercase.
-
-
- Note that 'alphabetic' is determined by the current locale. This
- means that in i.e. the default "C" locale, characters such as
- umlaut-A (Ä) will not be converted.
-
-
- strtolower example
-
+
+
+ strtolower
+ Make a string lowercase
+
+
+ Description
+
+ stringstrtolower
+ stringstr
+
+
+ Returns string with all alphabetic
+ characters converted to lowercase.
+
+
+ Note that 'alphabetic' is determined by the current locale. This
+ means that in i.e. the default "C" locale, characters such as
+ umlaut-A (Ä) will not be converted.
+
+
+ strtolower example
+
]]>
-
-
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strtoupper, ucfirst,
- ucwords and mb_strtolower.
-
-
-
+
+ See also strtoupper, ucfirst,
+ ucwords and mb_strtolower.
+
+
+
+
-
-
- strtoupper
- Make a string uppercase
-
-
- Description
-
- stringstrtoupper
- stringstring
-
-
- Returns string with all alphabetic
- characters converted to uppercase.
-
-
- Note that 'alphabetic' is determined by the current locale. For
- instance, in the default "C" locale characters such as umlaut-a
- (ä) will not be converted.
-
-
- strtoupper example
-
+
+
+ strtoupper
+ Make a string uppercase
+
+
+ Description
+
+ stringstrtoupper
+ stringstring
+
+
+ Returns string with all alphabetic
+ characters converted to uppercase.
+
+
+ Note that 'alphabetic' is determined by the current locale. For
+ instance, in the default "C" locale characters such as umlaut-a
+ (ä) will not be converted.
+
+
+ strtoupper example
+
]]>
-
-
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strtolower, ucfirst,
- ucwords and mb_strtoupper.
-
-
-
+
+ See also strtolower, ucfirst,
+ ucwords and mb_strtoupper.
+
+
+
-
-
- substr_compare
-
- Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters
-
-
-
- Description
-
- intsubstr_compare
- stringmain_str
- stringstr
- intoffset
- intlength
- boolcase_insensitivity
-
+
+
+
+ substr_compare
+ Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters
+
+
+ Description
+
+ intsubstr_compare
+ stringmain_str
+ stringstr
+ intoffset
+ intlength
+ boolcase_insensitivity
+
-
- substr_compare compares main_str
- from position offset with str
- up to length characters.
-
-
- Returns < 0 if main_str from position
- offset is less than str, >
- 0 if it is greater than str, and 0 if they are equal.
- If length is equal or greater than length of
- main_str and length is set,
- substr_compare prints warning and returns &false;.
-
-
- If case_insensitivity is &true;, comparison is case
- insensitive.
-
-
-
- A substr_compare example
-
+
+ substr_compare compares main_str
+ from position offset with str
+ up to length characters.
+
+
+ Returns < 0 if main_str from position
+ offset is less than str, >
+ 0 if it is greater than str, and 0 if they are equal.
+ If length is equal or greater than length of
+ main_str and length is set,
+ substr_compare prints warning and returns &false;.
+
+
+ If case_insensitivity is &true;, comparison is case
+ insensitive.
+
+
+
+ A substr_compare example
+
]]>
-
-
-
+
+
+
-
-
+
+
+
-
-
- substr_replace
- Replace text within a portion of a string
-
-
- Description
-
- mixedsubstr_replace
- mixedstring
- stringreplacement
- intstart
- intlength
-
-
- substr_replace replaces a copy of
- string delimited by the
- start and (optionally)
- length parameters with the string given in
- replacement. The result string is returned.
- If string is an array then array is returned.
-
-
- If start is positive, the replacing will
- begin at the start'th offset into
- string.
-
-
- If start is negative, the replacing will
- begin at the start'th character from the
- end of string.
-
-
- If length is given and is positive, it
- represents the length of the portion of
- string which is to be replaced. If it is
- negative, it represents the number of characters from the end of
- string at which to stop replacing. If it
- is not given, then it will default to strlen(
- string ); i.e. end the replacing at the
- end of string. Of course, if
- length is zero then this function will have the
- effect of inserting replacement into
- string at the given
- start offset.
-
-
-
- substr_replace example
-
+
+
+ substr_replace
+ Replace text within a portion of a string
+
+
+ Description
+
+ mixedsubstr_replace
+ mixedstring
+ stringreplacement
+ intstart
+ intlength
+
+
+ substr_replace replaces a copy of
+ string delimited by the
+ start and (optionally)
+ length parameters with the string given in
+ replacement. The result string is returned.
+ If string is an array then array is returned.
+
+
+ If start is positive, the replacing will
+ begin at the start'th offset into
+ string.
+
+
+ If start is negative, the replacing will
+ begin at the start'th character from the
+ end of string.
+
+
+ If length is given and is positive, it
+ represents the length of the portion of
+ string which is to be replaced. If it is
+ negative, it represents the number of characters from the end of
+ string at which to stop replacing. If it
+ is not given, then it will default to strlen(
+ string ); i.e. end the replacing at the
+ end of string. Of course, if
+ length is zero then this function will have the
+ effect of inserting replacement into
+ string at the given
+ start offset.
+
+
+
+ substr_replace example
+
\n";
echo substr_replace($var, '', 10, -1) . " \n";
?>
]]>
-
-
-
+
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also str_replace and
- substr.
-
-
-
+
+ See also str_replace and
+ substr.
+
+
+
+
-
-
- substr
- Return part of a string
-
-
- Description
-
- stringsubstr
- stringstring
- intstart
- intlength
-
-
- substr returns the portion of string
- specified by the start and
- length parameters.
-
-
- If start is non-negative, the returned string
- will start at the start'th position in
- string, counting from zero. For instance,
- in the string 'abcdef', the character at
- position 0 is 'a', the
- character at position 2 is
- 'c', and so forth.
-
-
- Basic substr usage
-
+
+
+ substr
+ Return part of a string
+
+
+ Description
+
+ stringsubstr
+ stringstring
+ intstart
+ intlength
+
+
+ substr returns the portion of string
+ specified by the start and
+ length parameters.
+
+
+ If start is non-negative, the returned string
+ will start at the start'th position in
+ string, counting from zero. For instance,
+ in the string 'abcdef', the character at
+ position 0 is 'a', the
+ character at position 2 is
+ 'c', and so forth.
+
+
+ Basic substr usage
+
]]>
-
-
-
- If start is negative, the returned string
- will start at the start'th character
- from the end of string.
-
-
- Using a negative start
-
+
+
+
+ If start is negative, the returned string
+ will start at the start'th character
+ from the end of string.
+
+
+ Using a negative start
+
]]>
-
-
-
- If length is given and is positive, the string
- returned will contain at most length characters
- beginning from start (depending on the length of
- string). If string is less
- than or equal to start characters long, &false;
- will be returned.
-
-
- If length is given and is negative, then that many
- characters will be omitted from the end of string
- (after the start position has been calculated when a
- start is negative). If
- start denotes a position beyond this truncation,
- an empty string will be returned.
-
-
- Using a negative length
-
+
+
+
+ If length is given and is positive, the string
+ returned will contain at most length characters
+ beginning from start (depending on the length of
+ string). If string is less
+ than or equal to start characters long, &false;
+ will be returned.
+
+
+ If length is given and is negative, then that many
+ characters will be omitted from the end of string
+ (after the start position has been calculated when a
+ start is negative). If
+ start denotes a position beyond this truncation,
+ an empty string will be returned.
+
+
+ Using a negative length
+
]]>
-
-
-
- See also strrchr,
- substr_replace,
- preg_match,
- trim,
- mb_substr and
- wordwrap.
-
-
-
+
+
+
+ See also strrchr,
+ substr_replace,
+ preg_match,
+ trim,
+ mb_substr and
+ wordwrap.
+
+
+
+
-
-
- ucwords
-
- Uppercase the first character of each word in a string
-
-
-
- Description
-
- stringucwords
- stringstr
-
-
- Returns a string with the first character of each word in
- str capitalized, if that character is
- alphabetic.
-
-
- The definition of a word is any string of characters
- that is immediately after a whitespace (These are:
- space, form-feed, newline, carriage return, horizontal tab,
- and vertical tab).
-
-
-
- ucwords example
-
+
+
+ ucwords
+ Uppercase the first character of each word in a string
+
+
+ Description
+
+ stringucwords
+ stringstr
+
+
+ Returns a string with the first character of each word in
+ str capitalized, if that character is
+ alphabetic.
+
+
+ The definition of a word is any string of characters
+ that is immediately after a whitespace (These are:
+ space, form-feed, newline, carriage return, horizontal tab,
+ and vertical tab).
+
+
+
+ ucwords example
+
]]>
-
-
-
+
+
+
- ¬e.bin-safe;
+ ¬e.bin-safe;
-
- See also strtoupper,
- strtolower and ucfirst.
-
-
-
+
+ See also strtoupper,
+ strtolower and ucfirst.
+
+
+
-
-
- vfprintf
- Write a formatted string to a stream
-
-
- Description
-
- intvfprintf
- resourcehandle
- stringformat
- arrayargs
-
-
- Write a string produced according to format
- to the stream resource specified by handle.
- format is described in the documentation for
- sprintf.
-
-
- Operates as fprintf but accepts an array of
- arguments, rather than a variable number of arguments.
-
-
- Returns the length of the outputted string.
-
-
- See also: printf,
- sprintf,
- sscanf, fscanf,
- vsprintf, and
- number_format.
-
-
-
- Examples
-
-
- vfprintf: zero-padded integers
-
+
+
+
+ vfprintf
+ Write a formatted string to a stream
+
+
+ Description
+
+ intvfprintf
+ resourcehandle
+ stringformat
+ arrayargs
+
+
+ Write a string produced according to format
+ to the stream resource specified by handle.
+ format is described in the documentation for
+ sprintf.
+
+
+ Operates as fprintf but accepts an array of
+ arguments, rather than a variable number of arguments.
+
+
+ Returns the length of the outputted string.
+
+
+ See also: printf,
+ sprintf,
+ sscanf, fscanf,
+ vsprintf, and
+ number_format.
+
+
+
+ Examples
+
+
+ vfprintf: zero-padded integers
+
]]>
-
-
-
-
-
+
+
+
+
+
+
-
-
- vprintf
- Output a formatted string
-
-
- Description
-
- intvprintf
- stringformat
- arrayargs
-
-
- Display array values as a formatted string according to
- format (which is described in the documentation
- for sprintf).
-
-
- Operates as printf but accepts an array of
- arguments, rather than a variable number of arguments.
-
-
- Returns the length of the outputted string.
-
-
- See also printf, sprintf,
- vsprintf
-
-
-
+
+
+ vprintf
+ Output a formatted string
+
+
+ Description
+
+ intvprintf
+ stringformat
+ arrayargs
+
+
+ Display array values as a formatted string according to
+ format (which is described in the documentation
+ for sprintf).
+
+
+ Operates as printf but accepts an array of
+ arguments, rather than a variable number of arguments.
+
+
+ Returns the length of the outputted string.
+
+
+ See also printf, sprintf,
+ vsprintf
+
+
+
+
-
-
- vsprintf
- Return a formatted string
-
-
- Description
-
- stringvsprintf
- stringformat
- arrayargs
-
-
- Return array values as a formatted string according to
- format (which is described in the documentation
- for sprintf).
-
-
- Operates as sprintf but accepts an array of
- arguments, rather than a variable number of arguments.
-
-
- See also sprintf and vprintf
-
-
-
+
+
+ vsprintf
+ Return a formatted string
+
+
+ Description
+
+ stringvsprintf
+ stringformat
+ arrayargs
+
+
+ Return array values as a formatted string according to
+ format (which is described in the documentation
+ for sprintf).
+
+
+ Operates as sprintf but accepts an array of
+ arguments, rather than a variable number of arguments.
+
+
+ See also sprintf and vprintf
+
+
+