diff --git a/reference/strings/functions/echo.xml b/reference/strings/functions/echo.xml
index 7e2643f0b3..9b45ec11bf 100644
--- a/reference/strings/functions/echo.xml
+++ b/reference/strings/functions/echo.xml
@@ -1,13 +1,13 @@
-
-
+
echoOutput one or more strings
-
- Description
+
+
+ &reftitle.description;
voidechostringarg1
@@ -25,6 +25,54 @@
pass more than one parameter to echo, the parameters
must not be enclosed within parentheses.
+
+ 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.
+]]>
+
+
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ arg1
+
+
+ The parameter to output.
+
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.examples;
echo examples
@@ -83,36 +131,30 @@ echo $some_var ? 'true': 'false'; // changing the statement around
-
- 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.
-]]>
-
-
-
+
+
+
+ &reftitle.notes;
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.
-
+
+
+ &reftitle.seealso;
+
+
+ print
+ printf
+ flush
+
+
+
+
-
+
explodeSplit a string by string
-
- Description
+
+
+ &reftitle.description;
arrayexplodestringdelimiter
@@ -18,22 +18,44 @@
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.
+
+
+
+ &reftitle.parameters;
- 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.
+
+
+ delimiter
+
+
+ The boundary string.
+
+
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ limit
+
+
+ If limit is set, the returned array will contain
+ a maximum of limit elements with the last
+ element containing the rest of string.
+
+
+ If the limit parameter is negative, all components
+ except the last -limit are returned.
+
+
+
+
Although implode can, for historical reasons,
@@ -42,12 +64,51 @@
delimiter argument comes before the
string argument.
-
-
- The limit parameter was added in PHP
- 4.0.1
-
-
+
+
+
+ &reftitle.returnvalues;
+
+ 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.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.1.0
+
+ Support for negative limits was added
+
+
+
+ 4.0.1
+
+ The limit parameter was added
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
explode examples
@@ -105,17 +166,25 @@ Array
+
+
+ &reftitle.notes;
¬e.bin-safe;
+
+
+ &reftitle.seealso;
- See also
- preg_split,
- str_split,
- strtok, and
- implode.
+
+ preg_split
+ str_split
+ strtok
+ implode
+
+
+
fprintfWrite a formatted string to a stream
-
- Description
+
+
+ &reftitle.description;
intfprintfresourcehandle
@@ -14,25 +15,59 @@
mixedargsmixed...
-
- 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.
-
+
+ Write a string produced according to format to the
+ stream resource specified by handle.
+
-
- Examples
+
+
+ &reftitle.parameters;
+
+
+
+ handle
+
+
+
+
+
+
+ format
+
+
+ See sprintf for a description of
+ format.
+
+
+
+
+ args
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the outputted string.
+
+
+
+
+ &reftitle.examples;
fprintf: zero-padded integers
@@ -71,6 +106,21 @@ echo "wrote $len bytes to currency.txt";
+
+
+ &reftitle.seealso;
+
+
+ printf
+ sprintf
+ sscanf
+ fscanf
+ vsprintf
+ number_format
+
+
+
+
-
+
get_html_translation_tableReturns the translation table used by htmlspecialchars and htmlentities
-
- Description
+
+
+ &reftitle.description;
arrayget_html_translation_tableinttable
@@ -19,18 +19,6 @@
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.
@@ -40,6 +28,48 @@
common form for them.
+
+
+
+ &reftitle.parameters;
+
+
+
+ table
+
+
+ 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.
+
+
+
+
+ quote_style
+
+
+ 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.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the translation table as an array.
+
+
+
+
+ &reftitle.examples;
Translation Table Example
@@ -57,12 +87,19 @@ $encoded = strtr($str, $trans);
"Hallo & <Frau> &
Krämer".
+
+
+
+ &reftitle.seealso;
- See also htmlspecialchars,
- htmlentities, and
- html_entity_decode.
+
+ htmlspecialchars
+ htmlentities
+ html_entity_decode
+
+
-
+
hebrevConvert logical Hebrew text to visual text
-
- Description
+
+
+ &reftitle.description;
stringhebrevstringhebrew_textintmax_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.
+ Converts logical Hebrew text to visual text.
- See also hebrevc
+ The function tries to avoid breaking words.
+
+
+ &reftitle.parameters;
+
+
+
+ hebrew_text
+
+
+ A Hebrew input string.
+
+
+
+
+ max_chars_per_line
+
+
+ This optional parameter indicates maximum number of characters per
+ line that will be returned.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the visual string.
+
+
+
+
+ &reftitle.seealso;
+
+
+ hebrevc
+
+
+
+
-
+
hebrevcConvert logical Hebrew text to visual text with newline conversion
-
- Description
+
+
+ &reftitle.description;
stringhebrevcstringhebrew_text
@@ -15,15 +15,54 @@
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.
+ difference that it converts newlines (\n) to "<br>\n".
- See also hebrev
+ The function tries to avoid breaking words.
+
+
+ &reftitle.parameters;
+
+
+
+ hebrew_text
+
+
+ A Hebrew input string.
+
+
+
+
+ max_chars_per_line
+
+
+ This optional parameter indicates maximum number of characters per
+ line that will be returned.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the visual string.
+
+
+
+
+ &reftitle.seealso;
+
+
+ hebrev
+
+
+
+
-
+
html_entity_decodeConvert all HTML entities to their applicable characters
-
- Description
+
+
+ &reftitle.description;
stringhtml_entity_decodestringstring
@@ -19,49 +19,105 @@
htmlentities in that it converts all HTML entities
to their applicable characters from string.
+
+
+
+ &reftitle.parameters;
- 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
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ quote_style
+
+
+ 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.
+
+
+
+
+
+
+
+
+ charset
+
+
+ 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;
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the decoded string.
+
+
+
+
+ &reftitle.changelog;
+
+
- Constant Name
- Description
+ &Version;
+ &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.
+ 5.0.0
+
+ Support for mutli-byte character sets was added.
+
-
+
+
+
+
+ &reftitle.examples;
- 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
@@ -97,26 +153,35 @@ 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.
-
-
-
-
- See also htmlentities,
- htmlspecialchars,
- get_html_translation_table,
- and urldecode.
+
+
+
+ &reftitle.notes;
+
+
+ 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.
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ htmlentities
+ htmlspecialchars
+ get_html_translation_table
+ urldecode
+
+
+
+
-
+
htmlentitiesConvert all applicable characters to HTML entities
-
- Description
+
+
+ &reftitle.description;
stringhtmlentitiesstringstring
@@ -16,61 +16,134 @@
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.
+ 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.
If you're wanting to decode instead (the reverse) you can use
html_entity_decode.
+
+
+
+ &reftitle.parameters;
+
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ quote_style
+
+
+ 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.
+
+
+
+
+
+
+
+
+ charset
+
+
+ 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;
+
+
+
+ double_encode
+
+
+ When double_encode is turned off PHP will not
+ encode existing html entities. The default is to convert everything.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the encoded string.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.2.3
+
+ The double_quote parameter was added.
+
+
+
+ 4.1.0
+
+ The charset parameter was added.
+
+
+
+ 4.0.3
+
+ The quote parameter was added.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
A htmlentities example
@@ -89,13 +162,21 @@ echo htmlentities($str, ENT_QUOTES);
+
+
+
+ &reftitle.seealso;
- See also html_entity_decode,
- get_html_translation_table,
- htmlspecialchars, nl2br,
- and urlencode.
+
+ html_entity_decode
+ get_html_translation_table
+ htmlspecialchars
+ nl2br
+ urlencode
+
+
-
+
implodeJoin array elements with a string
-
- Description
+
+
+ &reftitle.description;
stringimplodestringgluearraypieces
- Returns a string containing a string representation of all the
- array elements in the same order, with the glue string between
- each element.
+ Join array elements with a glue string.
+
+
+
+ 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.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ glue
+
+
+ Defaults to an empty string. This is not the preferred usage of
+ implode as glue would be
+ the second parameter and thus, the bad prototype would be used.
+
+
+
+
+ pieces
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns a string containing a string representation of all the array
+ elements in the same order, with the glue string between each element.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ The glue parameter became optional.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
+ implode example
@@ -31,31 +100,25 @@ echo $comma_separated; // lastname,email,phone
?>
]]>
-
+
-
-
- 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;
-
-
- See also explode, and split.
-
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ explode
+ split
+
+
+
+
-
+
localeconvGet numeric formatting information
-
- Description
+
+
+ &reftitle.description;
arraylocaleconv
@@ -16,6 +16,10 @@
Returns an associative array containing localized numeric and
monetary formatting information.
+
+
+
+ &reftitle.returnvalues;
localeconv returns data based upon the current locale
as set by setlocale. The associative array that is
@@ -134,7 +138,7 @@
- The n_sign_posn, and n_sign_posn contain a string
+ The p_sign_posn, and n_sign_posn contain a string
of formatting options. Each number representing one of the above listed conditions.
@@ -146,9 +150,14 @@
no further grouping is done. If an array element is equal to 0, the previous
element should be used.
-
- localeconv example
-
+
+
+
+ &reftitle.examples;
+
+
+ localeconv example
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also setlocale.
+
+
+
+
+ &reftitle.seealso;
+
+
+ setlocale
+
+
+
+
-
+
ltrimStrip whitespace (or other characters) from the beginning of a string
-
- Description
+
+
+ &reftitle.description;
stringltrimstringstrstringcharlist
-
-
- The second parameter was added in PHP 4.1.0
-
-
+
+ Strip whitespace (or other characters) from the beginning of a string.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ charlist
+
+
+ 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.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
This function returns a string with whitespace stripped from the
beginning of str.
@@ -63,15 +92,38 @@
+
+
+
+ &reftitle.changelog;
- 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.
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.1.0
+
+ The charlist parameter was added.
+
+
+
+
+
-
- Usage example of ltrim
-
+
+
+
+ &reftitle.examples;
+
+
+ Usage example of ltrim
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also trim and rtrim.
+
+
+
+
+ &reftitle.seealso;
+
+
+ trim
+ rtrim
+
+
+
+
-
+
metaphoneCalculate the metaphone key of a string
-
- Description
+
+
+ &reftitle.description;
stringmetaphonestringstr
@@ -17,13 +17,11 @@
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.
+ 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
@@ -31,6 +29,37 @@
1995].
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ phones
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the metaphone key as a string.
+
+
+
-
+
parse_strParses the string into variables
-
- Description
+
+
+ &reftitle.description;
voidparse_strstringstr
@@ -15,15 +15,8 @@
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.
+ passed via a URL and sets variables in the current scope.
-
-
- Support for the optional second parameter was added in PHP 4.0.3.
-
-
To get the current QUERY_STRING, you may use the variable
@@ -40,6 +33,66 @@
$_POST, etc. variables.
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ arr
+
+
+ If the second parameter arr is present,
+ variables are stored in this variable as array elements instead.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.0.3
+
+ The arr parameter was added
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
Using parse_str
@@ -62,12 +115,21 @@ echo $output['arr'][1]; // baz
+
+
+
+ &reftitle.seealso;
- See also parse_url, pathinfo,
- http_build_query,
- get_magic_quotes_gpc, and urldecode.
+
+ parse_url
+ pathinfo
+ http_build_query
+ get_magic_quotes_gpc
+ urldecode
+
+
-
+
printfOutput a formatted string
-
- Description
+
+
+ &reftitle.description;
intprintfstringformat
@@ -15,22 +15,62 @@
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.
+ Produces output according to format.
+
+
+ &reftitle.parameters;
+
+
+
+ format
+
+
+ See sprintf for a description of
+ format.
+
+
+
+
+ args
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the outputted string.
+
+
+
+
+ &reftitle.seealso;
+
+
+ print
+ sprintf
+ vprintf
+ sscanf
+ fscanf
+ flush
+
+
+
+
-
+
quoted_printable_decodeConvert a quoted-printable string to an 8 bit string
-
- Description
+
+
+ &reftitle.description;
stringquoted_printable_decodestringstr
-
- 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.
-
+
+ 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.
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the 8-bit binary string.
+
+
+
-
+
quotemetaQuote meta characters
-
- Description
+
+
+ &reftitle.description;
stringquotemetastringstr
- Returns a version of str with a backslash character
- (\) before every character that is among
- these: . \ + * ? [ ^ ] ( $ )
-
+ Returns a version of str with a backslash character (\)
+ before every character that is among these:
+ . \ + * ? [ ^ ] ( $ )
+
+
- ¬e.bin-safe;
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
-
- See also addslashes,
- addcslashes,
- htmlentities,
- htmlspecialchars,
- nl2br,
- stripslashes, and
- stripcslashes.
-
-
-
+
+ &reftitle.returnvalues;
+
+ Returns the string with meta characters quoted.
+
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ addslashes
+ addcslashes
+ htmlentities
+ htmlspecialchars
+ nl2br
+ stripslashes
+ stripcslashes
+
+
+
+
+
-
+
rtrimStrip whitespace (or other characters) from the end of a string
-
- Description
+
+
+ &reftitle.description;
stringrtrimstringstrstringcharlist
-
-
- 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:
@@ -63,15 +60,72 @@
+
+
+
+ &reftitle.parameters;
- 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.
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ charlist
+
+
+ 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
-
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the modified string.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.1.0
+
+ The charlist parameter was added.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
+
+
+ Usage example of rtrim
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
- See also trim and ltrim.
+
+
+
+
+ &reftitle.seealso;
+
+
+ trim
+ ltrim
+
+
+
+
+
sha1Calculate the sha1 hash of a string
-
- Description
+
+
+ &reftitle.description;
stringsha1stringstr
@@ -15,17 +16,69 @@
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;
-
-
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ raw_output
+
+
+ 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, otherwise the returned value is a 40-character
+ hexadecimal number. Defaults to &false;.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the sha1 hash as a string.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.0.0
+
+ The raw_output parameter was added.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
A sha1 example
@@ -43,12 +96,19 @@ if (sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
-
- See also sha1_file,
- crc32, and
- md5
-
+
+
+ &reftitle.seealso;
+
+
+ sha1_file
+ crc32
+ md5
+
+
+
+
-
+
similar_textCalculate the similarity between two strings
-
- Description
+
+
+ &reftitle.description;
intsimilar_textstringfirst
@@ -15,23 +15,65 @@
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.
+ 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.
-
+
+
+ &reftitle.parameters;
+
+
+
+ first
+
+
+ The first string.
+
+
+
+
+ second
+
+
+ The second string.
+
+
+
+
+ percent
+
+
+ By passing a reference as third argument,
+ similar_text will calculate the similarity in
+ percent for you.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the number of matching chars in both strings.
+
+
+
+
+ &reftitle.seealso;
+
+
+ levenshtein
+ soundex
+
+
+
+
-
+
soundexCalculate the soundex key of a string
-
- Description
+
+
+ &reftitle.description;
stringsoundexstringstr
@@ -27,6 +27,33 @@
in "The Art Of Computer Programming, vol. 3: Sorting And
Searching", Addison-Wesley (1973), pp. 391-392.
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the soundex key as a string.
+
+
+
+
+ &reftitle.examples;
Soundex Examples
@@ -44,13 +71,19 @@ soundex("Lukasiewicz") == soundex("Lissajous"); // L222
+
+
+
+ &reftitle.seealso;
- See also
- levenshtein,
- metaphone, and
- similar_text.
+
+ levenshtein
+ metaphone
+ similar_text
+
+
-
+
sprintfReturn a formatted string
-
- Description
+
+
+ &reftitle.description;
stringsprintfstringformatmixedargsmixed...
-
+
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).
-
-
-
-
-
+
+
+
+ &reftitle.parameters;
- As of PHP 4.0.6 the format string supports argument
- numbering/swapping. Here is an example:
-
- Argument swapping
-
+
+
+ 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).
+
+
+
+
+
+
+
+ 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
+
]]>
-
-
+
+
+
+
+
+
+ args
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
-
- See also printf,
- sscanf, fscanf,
- vsprintf, and
- number_format.
-
-
- Examples
+
+
+ &reftitle.returnvalues;
+
+ Returns a string produced according to the formatting string
+ format.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.0.6
+
+ Support for argument numbering/swapping was added
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
printf: various examples
@@ -234,9 +288,7 @@ printf("%%+d = '%+d'\n", $u); // sign specifier on a negative integer
?>
]]>
-
- The printout of this program would be:
-
+ &example.outputs;
]]>
-
- The printout of this program would be:
-
+ &example.outputs;
+
+
+ &reftitle.seealso;
+
+
+ printf
+ sscanf
+ fscanf
+ vsprintf
+ number_format
+
+
+
+
-
+
str_ireplaceCase-insensitive version of str_replace.
-
- Description
+
+
+ &reftitle.description;
mixedstr_ireplacemixedsearch
@@ -23,31 +23,99 @@
use this function instead of eregi_replace or
preg_replace with the i modifier.
+
+
+
+ &reftitle.parameters;
- 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.
+
+
+ search
+
+
+
+ Every replacement with search array is
+ performed on the result of previous replacement.
+
+
+
+
+
+ replace
+
+
+
+
+
+
+ subject
+
+
+ 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.
+
+
+
+
+ count
+
+
+ The number of matched and replaced needles will
+ be returned in count which is passed by
+ reference.
+
+
+
+
- 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
+ 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.
-
-
+
+
+
+ &reftitle.returnvalues;
+
+ Returns a string or an array of replacements.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.0.0
+
+ The count parameter was added.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
str_ireplace example
@@ -60,24 +128,28 @@ $bodytag = str_ireplace("%body%", "black", "");
-
- This function is binary safe.
-
+
+
+
+ &reftitle.notes;
-
- 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.
-
+
+ This function is binary safe.
+
+
+
+
+ &reftitle.seealso;
- See also:
- str_replace,
- preg_replace, and
- strtr.
+
+ str_replace
+ preg_replace
+ strtr
+
+
-
+
str_padPad a string to a certain length with another string
-
- Description
+
+
+ &reftitle.description;
stringstr_padstringinput
@@ -24,17 +24,67 @@
is padded with characters from pad_string
up to the limit.
+
+
+
+ &reftitle.parameters;
- 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.
+
+
+ input
+
+
+ The input string.
+
+
+
+
+ pad_length
+
+
+ If the value of pad_length is negative or
+ less than the length of the input string, no padding takes place.
+
+
+
+
+ pad_string
+
+
+
+ The pad_string may be truncated if the
+ required number of padding characters can't be evenly divided by the
+ pad_string's length.
+
+
+
+
+
+ pad_type
+
+
+ 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.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
- If the value of pad_length is negative or
- less than the length of the input string, no padding takes place.
+ Returns the padded string.
+
+
+
+
+ &reftitle.examples;
str_pad example
@@ -51,14 +101,8 @@ echo str_pad($input, 6 , "___"); // produces "Alien_"
-
-
- The pad_string may be truncated if the
- required number of padding characters can't be evenly divided by
- the pad_string's length.
-
-
+
-
+
str_replaceReplace all occurrences of the search string with the replacement string
-
- Description
+
+
+ &reftitle.description;
mixedstr_replacemixedsearch
@@ -18,51 +18,125 @@
This function returns a string or an array with all occurrences of
search in subject
- replaced with the given replace value. If you
- don't need fancy replacing rules (like regular expressions), you should
- always use this function instead of ereg_replace or
- preg_replace.
+ replaced with the given replace value.
- As of PHP 4.0.5, every parameter in str_replace
- can be an array.
+ If you don't need fancy replacing rules (like regular expressions), you
+ should always use this function instead of ereg_replace
+ or preg_replace.
-
-
- In PHP versions prior to 4.3.3 a bug existed when using arrays as
- both search and replace
- parameters which caused empty search indexes
- to be skipped without advancing the internal pointer on the
- replace array. This has been corrected in
- PHP 4.3.3, any scripts which relied on this bug
- should remove empty search values prior to calling this function in
- order to mimick the original behavior.
-
-
+
+
+
+ &reftitle.parameters;
- 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_replace 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. The converse would not make sense,
- though.
+ If search and replace are
+ arrays, then str_replace 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. The converse would not make sense, though.
If search or replace
are arrays, their elements are processed first to last.
+
+
+
+ search
+
+
+
+
+
+
+ replace
+
+
+
+
+
+
+ subject
+
+
+ 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.
+
+
+
+
+ count
+
+
+
+ If passed, this will hold the number of matched and replaced needles.
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ This function returns a string or an array with the replaced values.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.0.0
+
+ The count parameter was added.
+
+
+
+ 4.3.3
+
+ The behaviour of this function changed. In older versions a bug
+ existed when using arrays as both search and
+ replace parameters which caused empty
+ search indexes to be skipped without advancing
+ the internal pointer on the replace array.
+ This has been corrected in PHP 4.3.3, any scripts which relied on
+ this bug should remove empty search values prior to calling this
+ function in order to mimick the original behavior.
+
+
+
+ 4.0.5
+
+ Most parameters can now be an array.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
str_replace examples
@@ -105,32 +179,31 @@ echo $output;
+
+
+ &reftitle.notes;
¬e.bin-safe;
-
This function is case-sensitive. Use str_ireplace
for case-insensitive replace.
+
-
-
- As of PHP 5.0.0 the number of matched and replaced
- needles (search) will be returned in
- count which is passed by reference.
- Prior to PHP 5.0.0 this parameter is not available.
-
-
+
+ &reftitle.seealso;
- See also
- str_ireplace,
- substr_replace,
- preg_replace, and
- strtr.
+
+ str_ireplace
+ substr_replace
+ preg_replace
+ strtr
+
+
-
+
str_rot13Perform the rot13 transform on a string
-
- Description
+
+
+ &reftitle.description;
stringstr_rot13stringstr
- 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.
+ 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.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the ROT13 version of the given string.
+
+
+
+
+ &reftitle.examples;
str_rot13 example
@@ -34,14 +63,34 @@ echo str_rot13('PHP 4.3.0'); // CUC 4.3.0
-
-
- The behaviour of this function was buggy until PHP 4.3.0. Before
- this, the str was also modified, as if
- passed by reference.
-
-
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ The behaviour of this function was fixed. Before this fix, the
+ str was also modified, as if it was passed
+ by reference.
+
+
+
+
+
+
+
+
+
str_splitConvert a string to an array
-
- Description
+
+
+ &reftitle.description;
arraystr_splitstringstringintsplit_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
+ Converts a string to an array.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ split_length
+
+
+ Maximum length of the chunk.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 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.
+ &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.
+
+
+
+ &reftitle.examples;
Example uses of str_split
@@ -43,9 +78,7 @@ print_r($arr2);
?>
]]>
-
- Output may look like:
-
+ &example.outputs;
+
+
+
+ &reftitle.seealso;
- See also chunk_split,
- preg_split,
- explode,
- count_chars,
- str_word_count, and
- for.
+
+ chunk_split
+ preg_split
+ explode
+ count_chars
+ str_word_count
+ for
+
+
-
+
strcasecmpBinary safe case-insensitive string comparison
-
- Description
+
+
+ &reftitle.description;
intstrcasecmpstringstr1stringstr2
+
+ Binary safe case-insensitive string comparison.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string
+
+
+
+
+ str2
+
+
+ The second string
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
Returns < 0 if str1 is less than
str2; > 0 if str1
is greater than str2, and 0 if they are
equal.
+
+
+
+
+ &reftitle.examples;
+ strcasecmp example
@@ -31,18 +68,24 @@ if (strcasecmp($var1, $var2) == 0) {
?>
]]>
-
+
-
- See also
- preg_match,
- strcmp,
- substr,
- stristr,
- strncasecmp, and
- strstr.
-
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcmp
+ substr
+ stristr
+ strncasecmp
+ strstr
+
+
+
+
-
+
strcmpBinary safe string comparison
-
- Description
+
+
+ &reftitle.description;
intstrcmpstringstr1stringstr2
+ Note that this comparison is case sensitive.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
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.
-
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcasecmp
+ substr
+ stristr
+ strncasecmp
+ strncmp
+ strstr
+
+
+
+
-
+
strcollLocale based string comparison
-
- Description
+
+
+ &reftitle.description;
intstrcollstringstr1stringstr2
-
+
+ Note that this comparison is case sensitive, and unlike
+ strcmp this function is not binary safe.
+
+
+ strcoll uses the current locale for doing the
+ comparisons. If the current locale is C or POSIX, this function is
+ equivalent to strcmp.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
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.
-
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.2.3
+
+ This function now works on win32.
+
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcmp
+ strcasecmp
+ substr
+ stristr
+ strncasecmp
+ strncmp
+ strstr
+ setlocale
+
+
+
+
-
+
strcspnFind length of initial segment not matching mask
-
- Description
+
+
+ &reftitle.description;
intstrcspnstringstr1
@@ -15,24 +15,97 @@
intstartintlength
-
+
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;
-
-
- See also strspn.
-
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+
+
+
+
+ str2
+
+
+
+
+
+
+ start
+
+
+ The start position of the string to examine.
+
+
+
+
+ length
+
+
+ The length of the string to examine.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the segment as an integer.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ The start and length
+ were added
+
+
+
+
+
+
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ strspn
+
+
+
+
-
+
strip_tagsStrip HTML and PHP tags from a string
-
- Description
+
+
+ &reftitle.description;
stringstrip_tagsstringstrstringallowable_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.
+ 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.
+
+
+
+ &reftitle.parameters;
- 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.
-
-
+
+
+ str
+
+
+ The input string.
+
+
+
+
+ allowable_tags
+
+
+ You can use the optional second parameter to specify tags which should
+ not be stripped.
+
+
+
+ HTML comments are also stripped. This is hardcoded and can not be
+ changed with allowable_tags.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the stripped string.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 5.0.0
+
+ strip_tags is now binary safe
+
+
+
+ 4.3.0
+
+ HTML comments are now always stripped
+
+
+
+ 4.0.0
+
+ The allowable_tags parameter was added
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
strip_tags example
@@ -73,13 +120,37 @@ Test paragraph. Other text
+
+
+
+ &reftitle.notes;
+
+
+ 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.
+
+
+
+
+
+ &reftitle.seealso;
- strip_tags has been binary safe since PHP 5.0.0
-
-
- See also htmlspecialchars.
+
+ htmlspecialchars
+
+
+
striposFind position of first occurrence of a case-insensitive string
-
- Description
+
+
+ &reftitle.description;
intstriposstringhaystack
@@ -16,20 +17,64 @@
Returns the numeric position of the first occurrence of
needle in the haystack
- string. Unlike strpos,
- stripos is case-insensitive.
+ string.
- Note that the needle may be a string of one or
- more characters.
+ Unlike strpos, stripos is
+ case-insensitive.
+
+
+
+ &reftitle.parameters;
+
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+ Note that the needle may be a string of one or
+ more characters.
+
+
+ If needle is not a string, it is converted to
+ an integer and applied as the ordinal value of a character.
+
+
+
+
+ offset
+
+
+ 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.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
If needle is not found,
stripos will return boolean &false;.
-
&return.falseproblem;
+
+
+ &reftitle.examples;
stripos examples
@@ -58,26 +103,29 @@ if ($pos2 !== false) {
-
- 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.
-
+
+
+ &reftitle.notes;
¬e.bin-safe;
+
+
+ &reftitle.seealso;
- See also strpos, strrpos,
- strrchr, substr,
- stristr, strstr,
- strripos and str_ireplace.
+
+ strpos
+ strrpos
+ strrchr
+ substr
+ stristr
+ strstr
+ strripos
+ str_ireplace
+
+
-
+
stripslashesUn-quote string quoted with addslashes
-
- Description
+
+
+ &reftitle.description;
stringstripslashesstringstr
- Returns a string with backslashes stripped off.
- (\' becomes ' and so on.)
- Double backslashes (\\) are made into a single
- backslash (\).
+ Un-quotes a quoted string.
@@ -30,9 +27,38 @@
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.
+ For example, if you're simply outputting data straight from an HTML form.
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns a string with backslashes stripped off.
+ (\' becomes ' and so on.)
+ Double backslashes (\\) are made into a single
+ backslash (\).
+
+
+
+
+ &reftitle.examples;
A stripslashes example
@@ -51,7 +77,8 @@ echo stripslashes($str);
stripslashes is not recursive. If you want to apply
- this function to a mutli-dimensional array, you need to use a recursive function.
+ this function to a mutli-dimensional array, you need to use a recursive
+ function.
@@ -96,14 +123,18 @@ Array
-
- For more information about "magic quotes", see get_magic_quotes_gpc.
-
-
- See also addslashes and
- get_magic_quotes_gpc.
-
+
+
+ &reftitle.seealso;
+
+
+ addslashes
+ get_magic_quotes_gpc
+
+
+
+
-
+
stristrCase-insensitive strstr
-
- Description
+
+
+ &reftitle.description;
stringstristrstringhaystack
@@ -16,16 +16,47 @@
Returns all of haystack from the first
occurrence of needle to the end.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+ If needle is not a string, it is converted to
+ an integer and applied as the ordinal value of a character.
+
+
+
+
+
+ needle and haystack
are examined in a case-insensitive manner.
+
+
+
+ &reftitle.returnvalues;
- 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.
+ Returns the matched substring. If needle is not
+ found, returns &false;.
+
+
+
+ &reftitle.examples;
stristr example
@@ -70,17 +101,25 @@
+
+
+ &reftitle.notes;
¬e.bin-safe;
+
+
+ &reftitle.seealso;
- See also
- strstr,
- strrchr,
- substr, and
- preg_match.
+
+ strstr
+ strrchr
+ substr
+ preg_match
+
+
-
+
strnatcasecmpCase insensitive string comparisons using a "natural order" algorithm
-
- Description
+
+
+ &reftitle.description;
intstrnatcasecmpstringstr1stringstr2
- 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.
+ 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.
-
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 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.
+
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcmp
+ strcasecmp
+ substr
+ stristr
+ strncasecmp
+ strncmp
+ strstr
+ setlocale
+
+
+
+
-
+
strnatcmpString comparisons using a "natural order" algorithm
-
- Description
+
+
+ &reftitle.description;
intstrnatcmpstringstr1
@@ -16,10 +16,51 @@
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:
+ described as a "natural ordering".
+ Note that this comparison is case sensitive.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 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.
+
+
+
+
+ &reftitle.examples;
+
+ 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:
-
+ &example.outputs;
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.
-
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcasecmp
+ substr
+ stristr
+ strcmp
+ strncmp
+ strncasecmp
+ strnatcasecmp
+ strstr
+ natsort
+ natcasesort
+
+
+
+
-
+
strncasecmpBinary safe case-insensitive string comparison of the first n characters
-
- Description
+
+
+ &reftitle.description;
intstrncasecmpstringstr1
@@ -15,25 +15,67 @@
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.
-
+ This function is similar to strcasecmp, with the
+ difference that you can specify the (upper limit of the) number of
+ characters from each string to be used in the comparison.
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+ len
+
+
+ The length of strings to be used in the comparison.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns < 0 if str1 is less than
+ str2; > 0 if str1 is
+ greater than str2, and 0 if they are equal.
+
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcmp
+ strcasecmp
+ substr
+ stristr
+ strstr
+
+
+
+
-
+
strncmpBinary safe string comparison of the first n characters
-
- Description
+
+
+ &reftitle.description;
intstrncmpstringstr1
@@ -16,27 +16,71 @@
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.
+ difference that you can specify the (upper limit of the) number of
+ characters from each string to be used in the comparison.
-
+
+ Note that this comparison is case sensitive.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+ len
+
+
+ Number of characters to use in the comparison.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
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.
-
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ strcmp
+ strcasecmp
+ substr
+ stristr
+ strncasecmp
+ strstr
+
+
+
+
-
+
strposFind position of first occurrence of a string
-
- Description
+
+
+ &reftitle.description;
intstrposstringhaystack
@@ -16,22 +16,63 @@
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;.
+ 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.
+
+
+ &reftitle.parameters;
+
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+ If needle is not a string, it is converted
+ to an integer and applied as the ordinal value of a character.
+
+
+
+
+ offset
+
+
+ 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.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the position as an integer. If needle is
+ not found, strpos will return boolean
+ &false;.
+
&return.falseproblem;
- ¬e.bin-safe;
+
+
+
+ &reftitle.examples;
- strpos examples
+ strpos examples
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
- 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.
+
+ strrpos
+ stripos
+ strripos
+ strrchr
+ substr
+ stristr
+ strstr
+
+
-
+
strrchrFind the last occurrence of a character in a string
-
- Description
+
+
+ &reftitle.description;
stringstrrchrstringhaystackstringneedle
- This function returns the portion of
- haystack which starts at the last
- occurrence of needle and goes until the
- end of haystack.
+ This function returns the portion of haystack which
+ starts at the last occurrence of needle and goes
+ until the end of haystack.
+
+
+
+ &reftitle.parameters;
- Returns &false; if needle is not found.
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+ 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.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
- If needle contains more than one
- character, only the first is used. This behavior is different from that
- of strchr.
+ This function returns the portion of string, or &false; if
+ needle is not found.
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ This function is now binary safe.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
- If needle is not a string, it is converted
- to an integer and applied as the ordinal value of a character.
strrchr example
@@ -44,16 +98,26 @@ $last = substr(strrchr($text, 10), 1 );
?>
]]>
-
-
-
- strrchr has been binary safe since PHP 4.3.0
-
-
- See also strstr, substr, and
- stristr.
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ strstr
+ substr
+ stristr
+
+
+
+
+
strriposFind position of last occurrence of a case-insensitive string in a string
-
- Description
+
+
+ &reftitle.description;
intstrriposstringhaystack
@@ -14,23 +15,65 @@
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.
+ Find position of last occurrence of a case-insensitive string in a string.
+ Unlike strrpos, strripos is
+ case-insensitive.
+
+
+
+ &reftitle.parameters;
- Note that the needle may be a string of one or
- more characters.
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+ Note that the needle may be a string of one or
+ more characters.
+
+
+
+
+ offset
+
+
+ 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.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the numerical position of the last occurence of
+ needle. Also note that string positions start at 0,
+ and not 1.
If needle is not found, &false; is returned.
-
&return.falseproblem;
+
+
+ &reftitle.examples;
A simple strripos example
@@ -51,9 +94,7 @@ if ($pos === false) {
?>
]]>
-
- Outputs:
-
+ &example.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.
-
+
+
+
+ &reftitle.seealso;
- See also strrpos,
- strrchr,
- substr, stripos and
- stristr.
+
+ strpos
+ stripos
+ strrchr
+ substr
+ stristr
+ strstr
+
+
-
+
strrposFind position of last occurrence of a char in a string
-
- Description
+
+
+ &reftitle.description;
intstrrposstringhaystack
@@ -68,15 +68,72 @@ if (is_bool($pos) && !$pos) {
character as of PHP 5.0.0.
+
+
+
+ &reftitle.seealso;
- See also strpos,
- strripos,
- strrchr,
- substr,
- stristr, and
- strstr.
+
+ strpos
+ strripos
+ strrchr
+ substr
+ stristr
+ strstr
+
+
+
+ &reftitle.parameters;
+
+
+
+ haystack
+
+
+
+
+
+
+ needle
+
+
+
+
+
+
+ offset
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ strpos
+ strripos
+ strrchr
+ substr
+ stristr
+ strstr
+
+
+
+
-
+
strspnFind length of initial segment matching mask
-
- Description
+
+
+ &reftitle.description;
intstrspnstringstr1
@@ -15,11 +15,9 @@
intstartintlength
-
- Returns the length of the initial segment of
- str1 which consists entirely of characters
- in str2.
-
+
+ Finds the length of the initial segment matching mask.
+
The line of code:
@@ -34,14 +32,86 @@ $var = strspn("42 is the answer, what is the question ...", "1234567890");
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.
-
+
+
+
+ &reftitle.parameters;
-
+
+
+ str1
+
+
+ The first string.
+
+
+
+
+ str2
+
+
+ The second string.
+
+
+
+
+ start
+
+
+ The start position of the string to examine.
+
+
+
+
+ length
+
+
+ The length of the string to examine.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the initial segment of str1
+ which consists entirely of characters in str2.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ The start and length
+ parameters were added
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
+
+
+ strspn example
]]>
-
+
-
- ¬e.bin-safe;
-
-
- See also strcspn.
-
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ strcspn
+
+
+
+
-
+
strstrFind first occurrence of a string
-
- Description
+
+
+ &reftitle.description;
stringstrstrstringhaystackstringneedle
- Returns part of haystack string from the
- first occurrence of needle to the end of
+ 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.
+
+
+ If you only want to determine if a particular needle
+ occurs within haystack, use the faster and less memory
+ intensive function strpos instead.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ haystack
+
+
+ The input string.
+
+
+
+
+ needle
+
+
+ If needle is not a string, it is converted to
+ an integer and applied as the ordinal value of a character.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the portion of string, or &false; if needle
+ is not found.
+
+
+
+
+ &reftitle.changelog;
+
+
+
+
+
+ &Version;
+ &Description;
+
+
+
+
+ 4.3.0
+
+ strstr was made binary safe.
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
strstr example
@@ -45,24 +106,21 @@ echo $domain; // prints @example.com
+
+
+
+ &reftitle.seealso;
-
-
- 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.
+
+ preg_match
+ stristr
+ strpos
+ strrchr
+ substr
+
+
-
+
strtolowerMake a string lowercase
-
- Description
+
+
+ &reftitle.description;
stringstrtolowerstringstr
- Returns string with all alphabetic
- characters converted to lowercase.
+ 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.
+ 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
-
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the lowercased string.
+
+
+
+
+ &reftitle.examples;
+
+
+ strtolower example
+
]]>
-
-
-
- ¬e.bin-safe;
-
-
- See also strtoupper, ucfirst,
- ucwords and mb_strtolower.
+
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ strtoupper
+ ucfirst
+ ucwords
+ mb_strtolower
+
+
+
+
-
+
strtoupperMake a string uppercase
-
- Description
+
+
+ &reftitle.description;
stringstrtoupperstringstring
- Returns string with all alphabetic
- characters converted to uppercase.
+ 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.
+ 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
-
+
+
+
+ &reftitle.parameters;
+
+
+
+ string
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the uppercased string.
+
+
+
+
+ &reftitle.examples;
+
+
+ strtoupper example
+
]]>
-
-
-
- ¬e.bin-safe;
-
-
- See also strtolower, ucfirst,
- ucwords and mb_strtoupper.
+
+
+
+
+ &reftitle.notes;
+ ¬e.bin-safe;
+
+
+
+ &reftitle.seealso;
+
+
+ strtolower
+ ucfirst
+ ucwords
+ mb_strtoupper
+
+
+
+
+
substr_compare
- Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters
+ Binary safe comparison of 2 strings from an offset, up to length characters
-
- Description
+
+
+ &reftitle.description;
intsubstr_comparestringmain_str
@@ -15,12 +16,62 @@
intlengthboolcase_insensitivity
-
substr_compare compares main_str
from position offset with str
up to length characters.
+
+
+
+ &reftitle.parameters;
+
+
+
+ main_str
+
+
+
+
+
+
+ str
+
+
+
+
+
+
+ offset
+
+
+ The start position for the comparison.
+
+
+
+
+ length
+
+
+ The length of the comparison.
+
+
+
+
+ case_insensitivity
+
+
+ If case_insensitivity is &true;, comparison is
+ case insensitive.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
Returns < 0 if main_str from position
offset is less than str, >
@@ -29,10 +80,10 @@
main_str and length is set,
substr_compare prints warning and returns &false;.
-
- If case_insensitivity is &true;, comparison is case
- insensitive.
-
+
+
+
+ &reftitle.examples;
A substr_compare example
@@ -50,8 +101,8 @@ echo substr_compare("abcde", "abc", 5, 1); // warning
-
+
-
+
substr_replaceReplace text within a portion of a string
-
- Description
+
+
+ &reftitle.description;
mixedsubstr_replacemixedstring
@@ -20,33 +20,77 @@
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.
+ replacement.
+
+
+
+ &reftitle.parameters;
- If start is positive, the replacing will
- begin at the start'th offset into
- string.
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ replacement
+
+
+ The replacement string.
+
+
+
+
+ start
+
+
+ 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.
+
+
+
+
+ length
+
+
+ If 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.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
- 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.
+ The result string is returned. If string is an
+ array then array is returned.
+
+
+
+ &reftitle.examples;
substr_replace example
@@ -74,14 +118,23 @@ echo substr_replace($var, '', 10, -1) . " \n";
+
+
+ &reftitle.notes;
¬e.bin-safe;
+
+
+ &reftitle.seealso;
- See also str_replace and
- substr.
+
+ str_replace
+ substr
+
+
-
+
substrReturn part of a string
-
- Description
+
+
+ &reftitle.description;
stringsubstrstringstring
@@ -15,22 +15,107 @@
intlength
- substr returns the portion of string
- specified by the start and
- length parameters.
+ Returns the portion of string specified by the
+ start and length parameters.
+
+
+
+ &reftitle.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.
+
+
+ string
+
+
+ The input string.
+
+
+
+
+ start
+
+
+ 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.
+
+
+ If start is negative, the returned string
+ will start at the start'th character
+ from the end of string.
+
+
+
+ Using a negative start
+
+
+]]>
+
+
+
+
+
+
+ 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
+
+
+]]>
+
+
+
+
+
-
- Basic substr usage
-
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the extracted part of string.
+
+
+
+
+ &reftitle.examples;
+
+
+ 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 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.
+
+
+
+
+ &reftitle.seealso;
+
+
+ strrchr
+ substr_replace
+ preg_match
+ trim
+ mb_substr
+ wordwrap
+
+
+
+
-
+
ucwordsUppercase the first character of each word in a string
-
- Description
+
+
+ &reftitle.description;
stringucwordsstringstr
Returns a string with the first character of each word in
- str capitalized, if that character is
- alphabetic.
+ 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).
-
+
+ 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).
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ str
+
+
+ The input string.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the modified string.
+
+
+
+
+ &reftitle.examples;
ucwords example
@@ -40,14 +65,24 @@ $bar = ucwords(strtolower($bar)); // Hello World!
+
+
+ &reftitle.notes;
¬e.bin-safe;
+
+
+ &reftitle.seealso;
- See also strtoupper,
- strtolower and ucfirst.
+
+ strtoupper
+ strtolower
+ ucfirst
+
+
+
vfprintfWrite a formatted string to a stream
-
- Description
+
+
+ &reftitle.description;
intvfprintfresourcehandlestringformatarrayargs
-
- Write a string produced according to format
- to the stream resource specified by handle.
- format is described in the documentation for
- sprintf.
-
-
+
+ Write a string produced according to format to the
+ stream resource specified by handle.
+
+
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
+
+
+ &reftitle.parameters;
+
+
+
+ handle
+
+
+
+
+
+
+ format
+
+
+ See sprintf for a description of
+ format.
+
+
+
+
+ args
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the outputted string.
+
+
+
+
+ &reftitle.examples;
vfprintf: zero-padded integers
@@ -53,6 +81,21 @@ vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day));
+
+
+ &reftitle.seealso;
+
+
+ printf
+ sprintf
+ sscanf
+ fscanf
+ vsprintf
+ number_format
+
+
+
+
-
+
vprintfOutput a formatted string
-
- Description
+
+
+ &reftitle.description;
intvprintfstringformatarrayargs
-
+
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
-
+
+
+
+ &reftitle.parameters;
+
+
+
+ format
+
+
+
+
+
+
+ args
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the length of the outputted string.
+
+
+
+
+ &reftitle.seealso;
+
+
+ printf
+ sprintf
+ vsprintf
+
+
+
+
-
+
vsprintfReturn a formatted string
-
- Description
+
+
+ &reftitle.description;
stringvsprintfstringformatarrayargs
-
+
+ Operates as sprintf but accepts an array of
+ arguments, rather than a variable number of arguments.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ format
+
+
+
+
+
+
+ args
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
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
-
+
+
+
+ &reftitle.seealso;
+
+
+ sprintf
+ vprintf
+
+
+
+