cvs: phpdoc /kr/functions strings.xml
| From: | cycle98 | Date: | Tue, 30 Jan 2001 04:17:21 +0000 |
| Subject: | cvs: phpdoc /kr/functions strings.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969334051@lists.php.net to get a copy of this message | ||
cycle98 Mon Jan 29 20:17:21 2001 EDT
Modified files:
/phpdoc/kr/functions strings.xml
Log:
1st translation english to korean by SeungHwan Lee
Index: phpdoc/kr/functions/strings.xml diff -u phpdoc/kr/functions/strings.xml:1.2 phpdoc/kr/functions/strings.xml:1.3 --- phpdoc/kr/functions/strings.xml:1.2 Fri Jan 12 06:16:40 2001 +++ phpdoc/kr/functions/strings.xml Mon Jan 29 20:17:20 2001 @@ -1,3253 +1,3254 @@ - <reference id="ref.strings"> - <title>String functions</title> - <titleabbrev>Strings</titleabbrev> - - <partintro> - <simpara> - These functions all manipulate strings in various ways. Some more - specialized sections can be found in the regular expression and - URL handling sections. - </simpara> - - <para> - For information on how strings behave, especially with regard to - usage of single quotes, double quotes, and escape sequences, see - the <link linkend="language.types.string">Strings</link> entry in - the <link linkend="language.types">Types</link> section of the - manual. - </para> - </partintro> - - <refentry id="function.addcslashes"> - <refnamediv> - <refname>AddCSlashes</refname> - <refpurpose>Quote string with slashes in a C style</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>addcslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>charlist</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes before characters that are - listed in <parameter>charlist</parameter> parameter. It escapes - <literal>\n</literal>, <literal>\r</literal> etc. in C-like - style, characters with ASCII code lower than 32 and higher than - 126 are converted to octal representation. Be carefull when - escaping alphanumeric characters. You can specify a range in - <parameter>charlist</parameter> like "\0..\37", which would - escape all characters with ASCII code between 0 and 31. - <example> - <title><function>Addcslashes</function> example</title> - <programlisting role="php"> -$escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); - </programlisting> - </example> - <note> - <simpara> - Added in PHP4b3-dev.</simpara> - </note> - </para> - <para> - See also <function>stripcslashes</function>, - <function>stripslashes</function>, - <function>htmlspecialchars</function>, - <function>htmlspecialchars</function>, and - <function>quotemeta</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.addslashes"> - <refnamediv> - <refname>AddSlashes</refname> - <refpurpose>Quote string with slashes</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>addslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes before characters that need - to be quoted in database queries etc. These characters are - single quote (<literal>'</literal>), double quote - (<literal>"</literal>), backslash (<literal>\</literal>) - and NUL (the null byte). - </para> - <para> - See also <function>stripslashes</function>, - <function>htmlspecialchars</function>, and - <function>quotemeta</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.bin2hex"> - <refnamediv> - <refname>bin2hex</refname> - <refpurpose> - Convert binary data into hexadecimal representation - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>bin2hex</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an ASCII string containing the hexadecimal representation - of <parameter>str</parameter>. The conversion is done byte-wise - with the high-nibble first. - </para> - </refsect1> - </refentry> - - <refentry id="function.chop"> - <refnamediv> - <refname>Chop</refname> - <refpurpose>Remove trailing whitespace</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chop</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the argument string without trailing whitespace, - including newlines. - <example> - <title><function>Chop</function> example</title> - <programlisting role="php"> -$trimmed = chop ($line); - </programlisting> - </example> - </para> - <note> - <para> - <function>chop</function> is different than the Perl - <parameter>chop()</parameter> function, which removes the last - character in the string. - </para> - </note> - <para> - See also <function>trim</function>, <function>ltrim</function>, - <function>rtrim</function>, and <function>chop</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.chr"> - <refnamediv> - <refname>Chr</refname> - <refpurpose>Return a specific character</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chr</function></funcdef> - <paramdef>int <parameter>ascii</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a one-character string containing the character specified - by <parameter>ascii</parameter>. - <example> - <title><function>Chr</function> example</title> - <programlisting role="php"> -$str .= chr (27); /* add an escape character at the end of $str */ - -/* Often this is more useful */ - -$str = sprintf ("The string ends in escape: %c", 27); - </programlisting> - </example> - This function complements <function>ord</function>. See also - <function>sprintf</function> with a format string of - <literal>%c</literal>. - </para> - </refsect1> - </refentry> - - <refentry id="function.chunk-split"> - <refnamediv> - <refname>chunk_split</refname> - <refpurpose>Split a string into smaller chunks</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chunk_split</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int - <parameter><optional>chunklen</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>end</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Can be used to split a string into smaller chunks which is useful - for e.g. converting <link - linkend="function.base64-encode">base64_encode</link> output to - match RFC 2045 semantics. It inserts every - <parameter>chunklen</parameter> (defaults to 76) chars the string - <parameter>end</parameter> (defaults to "\r\n"). It returns the - new string leaving the original string untouched. - <example> - <title><function>Chunk_split</function> example</title> - <programlisting role="php"> -# format $data using RFC 2045 semantics - -$new_string = chunk_split (base64_encode($data)); - </programlisting> - </example> - This function is significantly faster than - <function>ereg_replace</function>. - <note> - <para> - This function was added in 3.0.6. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.convert-cyr-string"> - <refnamediv> - <refname>convert_cyr_string</refname> - <refpurpose> - Convert from one Cyrillic character set to another - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>convert_cyr_string</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>from</parameter></paramdef> - <paramdef>string <parameter>to</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function converts the given string from one Cyrillic - character set to another. The <parameter>from</parameter> and - <parameter>to</parameter> arguments are single characters that - represent the source and target Cyrillic character sets. The - supported types are: - <itemizedlist> - <listitem> - <simpara> - k - koi8-r - </simpara> - </listitem> - <listitem> - <simpara> - w - windows-1251 - </simpara> - </listitem> - <listitem> - <simpara> - i - iso8859-5 - </simpara> - </listitem> - <listitem> - <simpara> - a - x-cp866 - </simpara> - </listitem> - <listitem> - <simpara> - d - x-cp866 - </simpara> - </listitem> - <listitem> - <simpara> - m - x-mac-cyrillic - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> - - <refentry id="function.count-chars"> - <refnamediv> - <refname>count_chars</refname> - <refpurpose> - Return information abouts characters used in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>count_chars</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef> - <parameter> - <optional>mode</optional> - </parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Counts the number of occurances of every byte-value (0..255) in - <parameter>string</parameter> and returns it in various ways. - The optional parameter <parameter>Mode</parameter> default to - 0. Depending on <parameter>mode</parameter> - <function>count_chars</function> returns one of the following: - <itemizedlist> - <listitem> - <simpara> - 0 - an array with the byte-value as key and the freqency of - every byte as value. - </simpara> - </listitem> - <listitem> - <simpara> - 1 - same as 0 but only byte-values with a frequency greater - than zero are listed. - </simpara> - </listitem> - <listitem> - <simpara> - 2 - same as 0 but only byte-values with a frequency equal to - zero are listed. - </simpara> - </listitem> - <listitem> - <simpara> - 3 - a string containing all used byte-values is returned. - </simpara> - </listitem> - <listitem> - <simpara> - 4 - a string containing all not used byte-values is returned. - </simpara> - </listitem> - </itemizedlist> - </para> - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </refsect1> - </refentry> - - <refentry id="function.crc32"> - <refnamediv> - <refname>crc32</refname> - <refpurpose>Calculates the crc32 polynomial of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>crc32</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Generates the cyclic redundancy checksum polynomial of 32-bit lengths of - the <parameter>str</parameter>. This is usually used to validate the - integrity of data being trasmited. - </para> - <para> - See also: <function>md5</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.crypt"> - <refnamediv> - <refname>crypt</refname> - <refpurpose>DES-encrypt a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>crypt</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string - <parameter><optional>salt</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>crypt</function> will encrypt a string using the - standard Unix <abbrev>DES</abbrev> encryption method. Arguments - are a string to be encrypted and an optional two-character salt - string to base the encryption on. See the Unix man page for your - crypt function for more information. - </para> - <simpara> - If the salt argument is not provided, one will be randomly - generated by PHP. - </simpara> - <simpara> - Some operating systems support more than one type of encryption. - In fact, sometimes the standard DES encryption is replaced by an - MD5 based encryption algorithm. The encryption type is triggered - by the salt argument. At install time, PHP determines the - capabilities of the crypt function and will accept salts for - other encryption types. If no salt is provided, PHP will - auto-generate a standard 2-character DES salt by default, unless - the default encryption type on the system is MD5, in which case a - random MD5-compatible salt is generated. PHP sets a constant - named CRYPT_SALT_LENGTH which tells you whether a regular - 2-character salt applies to your system or the longer 12-char MD5 - salt is applicable. - </simpara> - <simpara> - If you are using the supplied salt, you should be aware that the - salt is generated once. If you are calling this function - recursively, this may impact both appearance and, to a certain - extent, security. - </simpara> - <simpara> - The standard DES encryption <function>crypt</function> contains - the salt as the first two characters of the output. - </simpara> - <simpara> - On systems where the crypt() function supports multiple - encryption types, the following constants are set to 0 or 1 - depending on whether the given type is available: - </simpara> - <itemizedlist> - <listitem> - <simpara> - CRYPT_STD_DES - Standard DES encryption with a 2-char SALT - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_EXT_DES - Extended DES encryption with a 9-char SALT - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_MD5 - MD5 encryption with a 12-char SALT starting with - $1$ - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_BLOWFISH - Extended DES encryption with a 16-char SALT - starting with $2$ - </simpara> - </listitem> - </itemizedlist> - <simpara> - There is no decrypt function, since <function>crypt</function> - uses a one-way algorithm. - </simpara> - <simpara> - See also: <function>md5</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.echo"> - <refnamediv> - <refname>echo</refname> - <refpurpose>Output one or more strings</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>echo</function></funcdef> - <paramdef>string <parameter>arg1</parameter></paramdef> - <paramdef>string - <parameter><optional>argn</optional>...</parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Outputs all parameters. - </simpara> - <para> - <function>Echo</function> is not actually a function (it is a - language construct) so you are not required to use parantheses - with it. - <example> - <title><function>Echo</function> example</title> - <programlisting role="php"> -echo "Hello World"; - -echo "This spans -multiple lines. The newlines will be -output as well"; - -echo "This spans\nmultiple lines. The newlines will be\noutput as well."; - </programlisting> - </example> - </para> - <note> - <para> - In fact, if you want to pass more than one parameter to echo, - you must not enclose the parameters within parentheses. - </para> - </note> - <simpara> - See also: - <function>print</function>, - <function>printf</function>, and - <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.explode"> - <refnamediv> - <refname>explode</refname> - <refpurpose>Split a string by string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>explode</function></funcdef> - <paramdef>string <parameter>separator</parameter></paramdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int - <parameter><optional>limit</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array of strings, each of which is a substring of - <parameter>string</parameter> formed by splitting it on boundaries formed - by the string <parameter>delim</parameter>. - If <parameter>limit</parameter> is set, the returned array will contaion - a maximum of <parameter>limit</parameter> elements with the last element - containing the whole rest of <parameter>string</parameter>. - </para> - <note> - <para> - The <parameter>limit</parameter> parameter was added in PHP 4.0.1 - </para> - </note> - <para> - <example> - <title><function>Explode</function> example</title> - <programlisting role="php"> -$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; -$pieces = explode (" ", $pizza); - </programlisting> - </example> - </para> - <note> - <para> - Although <function>implode</function> can for historical reasons - accept its parameters in either order, - <function>explode</function> cannot. You must ensure that the - <parameter>separator</parameter> argument comes before the - <parameter>string</parameter> argument. - </para> - </note> - <para> - See also <function>split</function> and - <function>implode</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.get-html-translation-table"> - <refnamediv> - <refname>get_html_translation_table</refname> - <refpurpose> - Returns the translation table used by - <function>htmlspecialchars</function> and - <function>htmlentities</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string - <function>get_html_translation_table</function> - </funcdef> - <paramdef>int <parameter>table</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>get_html_translation_table</function> will return the - translation table that is used internally for - <function>htmlspecialchars</function> and - <function>htmlentities</function>. There are two new defines - (<parameter>HTML_ENTITIES</parameter>, - <parameter>HTML_SPECIALCHARS</parameter>) that allow you to - specify the table you want. And as in the - <function>htmlspecialchars</function> and - <function>htmlentities</function> 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 <function>htmlspecialchars</function>. - <example> - <title>Translation Table Example</title> - <programlisting role="php"> -$trans = get_html_translation_table (HTML_ENTITIES); -$str = "Hallo & <Frau> & Krämer"; -$encoded = strtr ($str, $trans); - </programlisting> - </example> - The <literal>$encoded</literal> variable will now contain: "Hallo - &<sgmltag>amp</sgmltag>; - &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; - &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". - </para> - <para> - The cool thing is using <function>array_flip</function> to change - the direction of the translation. - <informalexample> - <programlisting role="php"> -$trans = array_flip ($trans); -$original = strtr ($str, $trans); - </programlisting> - </informalexample> - The content of <literal>$original</literal> would be: "Hallo & - <Frau> & Krämer". - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </para> - <para> - See also: <function>htmlspecialchars</function>, - <function>htmlentities</function>, <function>strtr</function>, - and <function>array_flip</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.get-meta-tags"> - <refnamediv> - <refname>get_meta_tags</refname> - <refpurpose> - Extracts all meta tag content attributes from a file and returns - an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>get_meta_tags</function></funcdef> - <paramdef>string <parameter>filename</parameter></paramdef> - <paramdef>int - <parameter><optional>use_include_path</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Opens <parameter>filename</parameter> and parses it line by line - for <meta> tags of the form - <example> - <title>Meta Tags Example</title> - <programlisting role="html"> -<meta name="author" content="name"> -<meta name="tags" content="php3 documentation"> -</head> <!-- parsing stops here --> - </programlisting> - </example> - (pay attention to line endings - PHP uses a native function to - parse the input, so a Mac file won't work on Unix). - </para> - <para> - The value of the name property becomes the key, the value of the - content property becomes the value of the returned array, so you - can easily use standard array functions to traverse it or access - single values. Special characters in the value of the name - property are substituted with '_', the rest is converted to lower - case. - </para> - <para> - Setting <parameter>use_include_path</parameter> to 1 will result - in PHP trying to open the file along the standard include path. - </para> - </refsect1> - </refentry> - - <refentry id="function.hebrev"> - <refnamediv> - <refname>hebrev</refname> - <refpurpose> - Convert logical Hebrew text to visual text - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>hebrev</function></funcdef> - <paramdef>string <parameter>hebrew_text</parameter></paramdef> - <paramdef>int - <parameter><optional>max_chars_per_line</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - The optional parameter <parameter>max_chars_per_line</parameter> - indicates maximum number of characters per line will be output. The - function tries to avoid breaking words. - </para> - <para> - See also <function>hebrevc</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.hebrevc"> - <refnamediv> - <refname>hebrevc</refname> - <refpurpose> - Convert logical Hebrew text to visual text with newline conversion - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>hebrevc</function></funcdef> - <paramdef>string <parameter>hebrew_text</parameter></paramdef> - <paramdef>int - <parameter><optional>max_chars_per_line</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>hebrev</function> with the - difference that it converts newlines (\n) to "<br>\n". - The optional parameter <parameter>max_chars_per_line</parameter> - indicates maximum number of characters per line will be output. The - function tries to avoid breaking words. - </para> - <para> - See also <function>hebrev</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.htmlentities"> - <refnamediv> - <refname>htmlentities</refname> - <refpurpose> - Convert all applicable characters to HTML entities - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>htmlentities</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is identical to - <function>htmlspecialchars</function> in all ways, except that - all characters which have HTML character entity equivalents are - translated into these entities. Like - <function>htmlspecialchars</function>, it takes an optional - second argument which indicates what should be done with single - and double quotes. <constant>ENT_COMPAT</constant> (the default) - will only convert double-quotes and leave single-quotes alone. - <constant>ENT_QUOTES</constant> will convert both double and - single quotes, and <constant>ENT_NOQUOTES</constant> will leave - both double and single quotes unconverted. - </para> - <para> - At present, the ISO-8859-1 character set is used. Note that the optional - second argument was added in PHP 3.0.17 and PHP 4.0.3. - </para> - <para> - See also <function>htmlspecialchars</function> and - <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.htmlspecialchars"> - <refnamediv> - <refname>htmlspecialchars</refname> - <refpurpose> - Convert special characters to HTML entities - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>htmlspecialchars</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Certain characters have special significance in HTML, and should - be represented by HTML entities if they are to preserve their - meanings. This function returns a string with some of these - conversions made; the translations made are those most - useful for everyday web programming. If you require all HTML - character entities to be translated, use - <function>htmlentities</function> instead. - </para> - <simpara> - This function is useful in preventing user-supplied text from - containing HTML markup, such as in a message board or guest book - application. The optional second argument, quote_style, tells the - function what to do with single and double quote characters. The - default mode, ENT_COMPAT, is the backwards compatible mode which only - translates the double-quote character and leaves the single-quote - untranslated. If ENT_QUOTES is set, both single and double quotes - are translated and if ENT_NOQUOTES is set neither single nor double quotes - are translated. - </simpara> - <para> - The translations performed are: - <itemizedlist> - <listitem> - <simpara> - '&' (ampersand) becomes '&amp;' - </simpara> - </listitem> - <listitem> - <simpara> - '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set. - </simpara> - </listitem> - <listitem> - <simpara> - ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set. - </simpara> - </listitem> - <listitem> - <simpara> - '<' (less than) becomes '&lt;' - </simpara> - </listitem> - <listitem> - <simpara> - '>' (greater than) becomes '&gt;' - </simpara> - </listitem> - </itemizedlist> - <example> - <title><function>htmlspecialchars</function> example</title> - <programlisting role="php"> -$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); - </programlisting> - </example> - </para> - <para> - Note that this function does not translate anything beyond what - is listed above. For full entity translation, see - <function>htmlentities</function>. Also note that the optional second - argument was added in PHP 3.0.17 and PHP 4.0.3. - </para> - <para> - See also <function>htmlentities</function> and - <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.implode"> - <refnamediv> - <refname>implode</refname> - <refpurpose>Join array elements with a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>implode</function></funcdef> - <paramdef>string <parameter>glue</parameter></paramdef> - <paramdef>array <parameter>pieces</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string containing a string representation of all the - array elements in the same order, with the glue string between - each element. - <example> - <title><function>Implode</function> example</title> - <programlisting role="php"> -$colon_separated = implode (":", $array); - </programlisting> - </example> - </para> - <note> - <para> - <function>implode</function> can, for historical reasons, accept - its parameters in either order. For consistency with - <function>explode</function>, however, it may be less confusing - to use the documented order of arguments. - </para> - </note> - <simpara> - See also <function>explode</function>, <function>join</function>, - and <function>split</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.join"> - <refnamediv> - <refname>join</refname> - <refpurpose>Join array elements with a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>join</function></funcdef> - <paramdef>string <parameter>glue</parameter></paramdef> - <paramdef>array <parameter>pieces</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>join</function> is an alias to - <function>implode</function>, and is identical in every way. - </simpara> - <simpara> - See also <function>explode</function>, <function>implode</function>, - and <function>split</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.levenshtein"> - <refnamediv> - <refname>levenshtein</refname> - <refpurpose> - Calculate Levenshtein distance between two strings - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>cost_ins</parameter></paramdef> - <paramdef>int <parameter>cost_rep</parameter></paramdef> - <paramdef>int <parameter>cost_del</parameter></paramdef> - </funcprototype> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>function <parameter>cost</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns the Levenshtein-Distance between the - two argument strings or -1, if one of the argument strings - is longer than the limit of 255 characters (255 should be - more than enough for name or dictionary comparison, and - nobody serious would be doing genetic analysis with PHP). - </para> - <para> - The Levenshtein distance is defined as the minimal number of - characters you have to replace, insert or delete to transform - <parameter>str1</parameter> into <parameter>str2</parameter>. - The complexity of the algorithm is <literal>O(m*n)</literal>, - where <literal>n</literal> and <literal>m</literal> are the - length of <parameter>str1</parameter> and - <parameter>str2</parameter> (rather good when compared to - <function>similar_text</function>, which is O(max(n,m)**3), - but still expensive). - </para> - <para> - In its simpelest form the function will take only the two - strings as parameter and will calculate just the number of - insert, replace and delete operations needed to transform - <parameter>str1</parameter> into <parameter>str2</parameter>. - </para> - <para> - A second variant will take three additional parameters that - define the cost of insert, replace and delete operations. - This is more general and adaptive than variant one, but not - as efficient. - </para> - <para> - The third variant (which is not implemented yet) will be - the most general and adaptive, but also the slowest alternative. - It will call a user-supplied function that will determine the - cost for every possible operation. - </para> - <para> - The user-supplied function will be called with the following - arguments: - <itemizedlist> - <listitem> - <simpara> - operation to apply: 'I', 'R' or 'D' - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 2 - </simpara> - </listitem> - </itemizedlist> - The user-supplied function has to return a positive integer - describing the cost for this particular operation, but it - may decide to use only some of the supplied arguments. - </para> - <para> - The user-supplied function approach offers the possibility to - take into account the relevance of and/or difference between - certain symbols (characters) or even the context those symbols - appear in to determine the cost of insert, replace and delete - operations, but at the cost of loosing all optimizations done - regarding cpu register utilization and cache misses that have - been worked into the other two variants. - </para> - <para> - See also <function>soundex</function>, - <function>similar_text</function> - and <function>metaphone</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ltrim"> - <refnamediv> - <refname>ltrim</refname> - <refpurpose> - Strip whitespace from the beginning of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ltrim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function strips whitespace from the start of a string and - returns the stripped string. The whitespace - characters it currently strips are: "\n", "\r", "\t", "\v", "\0", - and a plain space. - </para> - <para> - See also <function>chop</function>, <function>rtrim</function>, and - <function>trim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.md5"> - <refnamediv> - <refname>md5</refname> - <refpurpose>Calculate the md5 hash of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>md5</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the MD5 hash of <parameter>str</parameter> using the - <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. - MD5 Message-Digest Algorithm</ulink>. - </para> - <para> - See also: <function>crc32</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.metaphone"> - <refnamediv> - <refname>Metaphone</refname> - <refpurpose>Calculate the metaphone key of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>metaphone</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the metaphone key of <parameter>str</parameter>. - </para> - <para> - Similar to <function>soundex</function> metaphone creates the - same key for similar sounding words. It's more accurate than - <function>soundex</function> as it knows the basic rules of - English pronunciation. The metaphone generated keys are of - variable length. - </para> - <para> - Metaphone was developed by Lawrence Philips - <lphilips@verity.com>. It is described in ["Practical - Algorithms for Programmers", Binstock & Rex, Addison Wesley, - 1995]. - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.nl2br"> - <refnamediv> - <refname>nl2br</refname> - <refpurpose>Converts newlines to HTML line breaks</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>nl2br</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with '<BR>' inserted - before all newlines. - </para> - <para> - See also <function>htmlspecialchars</function>, - <function>htmlentities</function> and - <function>wordwrap</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ord"> - <refnamediv> - <refname>Ord</refname> - <refpurpose>Return ASCII value of character</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>ord</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the ASCII value of the first character of - <parameter>string</parameter>. This function complements - <function>chr</function>. - <example> - <title><function>Ord</function> example</title> - <programlisting role="php"> -if (ord ($str) == 10) { - echo "The first character of \$str is a line feed.\n"; -} - </programlisting> - </example> - </para> - <simpara> - See also <function>chr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.parse-str"> - <refnamediv> - <refname>parse_str</refname> - <refpurpose>Parses the string into variables</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>void <function>parse_str</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>array <parameter><optional>arr</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Parses <parameter>str</parameter> as if it were the query string - passed via an URL and sets variables in the current scope. If - the second parameter <parameter>arr</parameter> is present, - variables are stored in this variable as an array elements instead. - </para> - <para> - <example> - <title>Using <function>parse_str</function></title> - <programlisting role="php"> -$str = "first=value&second[]=this+works&second[]=another"; -parse_str($str); -echo $first; /* prints "value" */ -echo $second[0]; /* prints "this works" */ -echo $second[1]; /* prints "another" */ - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.print"> - <refnamediv> - <refname>print</refname> - <refpurpose>Output a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>print</function></funcdef> - <paramdef>string <parameter>arg</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Outputs <parameter>arg</parameter>. - </simpara> - <simpara> - See also: <function>echo</function>, <function>printf</function>, - and <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.printf"> - <refnamediv> - <refname>printf</refname> - <refpurpose>Output a formatted string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>printf</function></funcdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>mixed - <parameter><optional>args</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Produces output according to <parameter>format</parameter>, which - is described in the documentation for <function>sprintf</function>. - </simpara> - <simpara> - See also: <function>print</function>, <function>sprintf</function>, - <function>sscanf</function>, <function>fscanf</function>, - and <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.quoted-printable-decode"> - <refnamediv> - <refname>quoted_printable_decode</refname> - <refpurpose> - Convert a quoted-printable string to an 8 bit string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string - <function>quoted_printable_decode</function> - </funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - This function returns an 8-bit binary string corresponding to the - decoded quoted printable string. This function is similar to - <function>imap_qprint</function>, except this one does not - require the IMAP module to work. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.quotemeta"> - <refnamediv> - <refname>quotemeta</refname> - <refpurpose>Quote meta characters</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>quotemeta</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a version of str with a backslash character - (<literal>\</literal>) before every character that is among - these: <screen>. \\ + * ? [ ^ ] ( $ )</screen> - </para> - <simpara> - See also <function>addslashes</function>, - <function>htmlentities</function>, - <function>htmlspecialchars</function>, - <function>nl2br</function>, and - <function>stripslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.rtrim"> - <refnamediv> - <refname>rtrim</refname> - <refpurpose>Remove trailing whitespace.</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcdef>string <function>rtrim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcsynopsis> - <para> - Returns the argument string without trailing whitespace, - including newlines. This is an alias for <function>chop</function>. - <example> - <title><function>rtrim</function> example</title> - <programlisting role="php"> -$trimmed = rtrim ($line); - </programlisting> - </example> - </para> - <para> - See also <function>trim</function>, <function>ltrim</function>, and - <function>rtrim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.sscanf"> - <refnamediv> - <refname>sscanf</refname> - <refpurpose>Parses input from a string according to a format</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>sscanf</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>string - <parameter><optional>var1</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - The function <function>sscanf</function> is the input analog of - <function>printf</function>. <function>Sscanf</function> reads from - the string <parameter>str</parameter> and interprets it according to - the specified <parameter>format</parameter>. If only two parameters were - passed to this function, the values parsed will be returned as an array. - <example> - <title><function>Sscanf</function> Example</title> - <programlisting role="php"> -// getting the serial number -$serial = sscanf("SN/2350001","SN/%d"); -// and the date of manufacturing -$mandate = "January 01 2000"; -list($month, $day, $year) = sscanf($mandate,"%s %d %d"); -echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; - </programlisting> - </example> - If optional parameters are passed, the function will return the number of - assigned values. The optional parameters must be passed by reference. - <example> - <title><function>Sscanf</function> - using optional parameters</title> - <programlisting role="php"> -// get author info and generate DocBook entry -$auth = "24\tLewis Carroll"; -$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); -echo "<author id='$id'> - <firstname>$first</firstname> - <surname>$last</surname> -</author>\n"; - </programlisting> - </example> - </para> - <para> - See also: <function>fscanf</function>, <function>printf</function>, - and <function>sprintf</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.setlocale"> - <refnamediv> - <refname>setlocale</refname> - <refpurpose>Set locale information</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>setlocale</function></funcdef> - <paramdef>string <parameter>category</parameter></paramdef> - <paramdef>string <parameter>locale</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <parameter>Category</parameter> is a string specifying the - category of the functions affected by the locale setting: - <itemizedlist> - <listitem> - <simpara> - LC_ALL for all of the below - </simpara> - </listitem> - <listitem> - <simpara> - LC_COLLATE for string comparison - not currently implemented in PHP - </simpara> - </listitem> - <listitem> - <simpara> - LC_CTYPE for character classification and conversion, for - example <function>strtoupper</function> - </simpara> - </listitem> - <listitem> - <simpara> - LC_MONETARY for localeconv() - not currently implemented in - PHP - </simpara> - </listitem> - <listitem> - <simpara> - LC_NUMERIC for decimal separator - </simpara> - </listitem> - <listitem> - <simpara> - LC_TIME for date and time formatting with - <function>strftime</function> - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - If <parameter>locale</parameter> is the empty string - <literal>""</literal>, the locale names will be set from the - values of environment variables with the same names as the above - categories, or from "LANG". - </para> - <para> - If locale is zero or <literal>"0"</literal>, the locale setting - is not affected, only the current setting is returned. - </para> - <para> - Setlocale returns the new current locale, or false if the locale - functionality is not implemented in the plattform, the specified - locale does not exist or the category name is invalid. - An invalid category name also causes a warning message. - </para> - </refsect1> - </refentry> - - <refentry id="function.similar-text"> - <refnamediv> - <refname>similar_text</refname> - <refpurpose> - Calculate the similarity between two strings - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>similar_text</function></funcdef> - <paramdef>string <parameter>first</parameter></paramdef> - <paramdef>string <parameter>second</parameter></paramdef> - <paramdef>double - <parameter><optional>percent</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - 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. - </para> - <para> - By passing a reference as third argument, - <function>similar_text</function> will calculate the similarity - in percent for you. It returns the number of matching chars in - both strings. - </para> - </refsect1> - </refentry> - - <refentry id="function.soundex"> - <refnamediv> - <refname>soundex</refname> - <refpurpose>Calculate the soundex key of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>soundex</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the soundex key of <parameter>str</parameter>. - </para> - <para> - 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. - </para> - <para> - 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. - </para> - <para> - <example> - <title>Soundex Examples</title> - <programlisting role="php"> -soundex ("Euler") == soundex ("Ellery") == 'E460'; -soundex ("Gauss") == soundex ("Ghosh") == 'G200'; -soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; -soundex ("Knuth") == soundex ("Kant") == 'K530'; -soundex ("Lloyd") == soundex ("Ladd") == 'L300'; -soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.sprintf"> - <refnamediv> - <refname>sprintf</refname> - <refpurpose>Return a formatted string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>sprintf</function></funcdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>mixed - <parameter><optional>args</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns a string produced according to the formatting string - <parameter>format</parameter>. - </simpara> - <simpara> - The format string is composed of zero or more directives: - ordinary characters (excluding <literal>%</literal>) that are - copied directly to the result, and <emphasis>conversion - specifications</emphasis>, each of which results in fetching its - own parameter. This applies to both <function>sprintf</function> - and <function>printf</function>. - </simpara> - <para> - Each conversion specification consists of a percent sign - (<literal>%</literal>), followed by one or more of these - elements, in order: - <orderedlist> - <listitem> - <simpara> - An optional <emphasis>padding specifier</emphasis> that says - what character will be used for padding the results to the - right string size. This may be a space character or a - <literal>0</literal> (zero character). The default is to pad - with spaces. An alternate padding character can be specified - by prefixing it with a single quote (<literal>'</literal>). - See the examples below. - </simpara> - </listitem> - <listitem> - <simpara> - An optional <emphasis>alignment specifier</emphasis> that says - if the result should be left-justified or right-justified. - The default is right-justified; a <literal>-</literal> - character here will make it left-justified. - </simpara> - </listitem> - <listitem> - <simpara> - An optional number, a <emphasis>width specifier</emphasis> - that says how many characters (minimum) this conversion should - result in. - </simpara> - </listitem> - <listitem> - <simpara> - An optional <emphasis>precision specifier</emphasis> that says - how many decimal digits should be displayed for floating-point - numbers. This option has no effect for other types than - double. (Another function useful for formatting numbers is - <function>number_format</function>.) - </simpara> - </listitem> - <listitem> - <para> - A <emphasis>type specifier</emphasis> that says what type the - argument data should be treated as. Possible types: - <simplelist> - <member> - <literal>%</literal> - a literal percent character. No - argument is required. - </member> - <member> - <literal>b</literal> - the argument is treated as an - integer, and presented as a binary number. - </member> - <member> - <literal>c</literal> - the argument is treated as an - integer, and presented as the character with that ASCII - value. - </member> - <member> - <literal>d</literal> - the argument is treated as an - integer, and presented as a decimal number. - </member> - <member> - <literal>f</literal> - the argument is treated as a double, - and presented as a floating-point number. - </member> - <member> - <literal>o</literal> - the argument is treated as an - integer, and presented as an octal number. - </member> - <member> - <literal>s</literal> - the argument is treated as and - presented as a string. - </member> - <member> - <literal>x</literal> - the argument is treated as an integer - and presented as a hexadecimal number (with lowercase - letters). - </member> - <member> - <literal>X</literal> - the argument is treated as an integer - and presented as a hexadecimal number (with uppercase - letters). - </member> - </simplelist> - </para> - </listitem> - </orderedlist> - </para> - <simpara> - See also: <function>printf</function>, <function>sscanf</function>, - <function>fscanf</function>, and <function>number_format</function>. - </simpara> - </refsect1> - <refsect1> - <title>Examples</title> - <para> - <example> - <title><function>Sprintf</function>: zero-padded integers</title> - <programlisting role="php"> -$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); - </programlisting> - </example> - <example> - <title><function>Sprintf</function>: formatting currency</title> - <programlisting role="php"> -$money1 = 68.75; -$money2 = 54.35; -$money = $money1 + $money2; -// echo $money will output "123.1"; -$formatted = sprintf ("%01.2f", $money); -// echo $formatted will output "123.10" - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.strncasecmp"> - <refnamediv> - <refname>strncasecmp</refname> - <refpurpose> - Binary safe case-insensitive string comparison of the first n characters - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strncasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>len</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>strcasecmp</function>, with the - difference that you can specify the (upper limit of the) number of - characters (<parameter>len</parameter>) from each string to be - used in the comparison. If any of the strings is shorter than - <parameter>len</parameter>, then the length of that string will be - used for the comparison. - </para> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - See also <function>ereg</function>, <function>strcasecmp</function>, - <function>strcmp</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strcasecmp"> - <refnamediv> - <refname>strcasecmp</refname> - <refpurpose> - Binary safe case-insensitive string comparison - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - <example> - <title><function>strcasecmp</function> example</title> - <programlisting role="php"> -$var1 = "Hello"; -$var2 = "hello"; -if (!strcasecmp ($var1, $var2)) { - echo '$var1 is equal to $var2 in a case-insensitive string comparison'; -} - </programlisting> - </example> - </para> - <simpara> - See also <function>ereg</function>, <function>strcmp</function>, - <function>substr</function>, <function>stristr</function>, - <function>strncasecmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strchr"> - <refnamediv> - <refname>strchr</refname> - <refpurpose> - Find the first occurrence of a character - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strchr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is an alias for <function>strstr</function>, and is - identical in every way. - </para> - </refsect1> - </refentry> - - <refentry id="function.strcmp"> - <refnamediv> - <refname>strcmp</refname> - <refpurpose>Binary safe string comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strncasecmp</function>, - <function>strncmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strcspn"> - <refnamediv> - <refname>strcspn</refname> - <refpurpose> - Find length of initial segment not matching mask - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcspn</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns the length of the initial segment of - <parameter>str1</parameter> which does <emphasis>not</emphasis> - contain any of the characters in <parameter>str2</parameter>. - </simpara> - <simpara> - See also <function>strspn</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strip-tags"> - <refnamediv> - <refname>strip_tags</refname> - <refpurpose>Strip HTML and PHP tags from a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strip_tags</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string - <parameter><optional>allowable_tags</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function tries to strip all HTML and PHP tags from the given - string. It errors on the side of caution in case of incomplete - or bogus tags. It uses the same tag stripping state machine as - the <function>fgetss</function> function. - </para> - <para> - You can use the optional second parameter to specify tags which - should not be stripped. - <note> - <para> - <parameter>Allowable_tags</parameter> was added in PHP 3.0.13, - PHP4B3. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.stripcslashes"> - <refnamediv> - <refname>stripcslashes</refname> - <refpurpose> - Un-quote string quoted with <function>addcslashes</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stripcslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes stripped off. Recognizes - C-like <literal>\n</literal>, <literal>\r</literal> ..., octal - and hexadecimal representation. - <note> - <simpara> - Added in PHP4b3-dev. - </simpara> - </note> - </para> - <simpara> - See also <function>addcslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.stripslashes"> - <refnamediv> - <refname>stripslashes</refname> - <refpurpose> - Un-quote string quoted with <function>addslashes</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stripslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes stripped off. - (<literal>\'</literal> becomes <literal>'</literal> and so on.) - Double backslashes are made into a single backslash. - </para> - <simpara> - See also <function>addslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.stristr"> - <refnamediv> - <refname>stristr</refname> - <refpurpose> - Case-insensitive <function>strstr</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stristr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns all of <parameter>haystack</parameter> from the first - occurrence of <parameter>needle</parameter> to the end. - <parameter>needle</parameter> and <parameter>haystack</parameter> - are examined in a case-insensitive manner. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - See also <function>strchr</function>, - <function>strrchr</function>, <function>substr</function>, and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strlen"> - <refnamediv> - <refname>strlen</refname> - <refpurpose>Get string length</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strlen</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the length of <parameter>string</parameter>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strnatcmp"> - <refnamediv> - <refname>strnatcmp</refname> - <refpurpose> - String comparisons using a "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strnatcmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - 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 <function>strcmp</function>) can be seen - below: - <informalexample> - <programlisting> -$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); -echo "Standard string comparison\n"; -usort($arr1,"strcmp"); -print_r($arr1); -echo "\nNatural order string comparison\n"; -usort($arr2,"strnatcmp"); -print_r($arr2); - </programlisting> - </informalexample> - The code above will generate the following output: - <informalexample> - <programlisting> -Standard string comparison -Array -( - [0] => img1.png - [1] => img10.png - [2] => img12.png - [3] => img2.png -) - -Natural order string comparison -Array -( - [0] => img1.png - [1] => img2.png - [2] => img10.png - [3] => img12.png -) - </programlisting> - </informalexample> - For more infomation see: Martin Pool's <ulink - url="&url.strnatcmp;">Natural Order String Comparison</ulink> - page. - </para> - <simpara> - Similar to other string comparison functions, this one returns - < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strncasecmp</function>, - <function>strnatcasecmp</function>, <function>strstr</function>, - <function>natsort</function> and <function>natcasesort</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strnatcasecmp"> - <refnamediv> - <refname>strnatcasecmp</refname> - <refpurpose> - Case insensitive string comparisons using a "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strnatcasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function implements a comparison algorithm that orders - alphanumeric strings in the way a human being would. The - behavior of this function is similar to - <function>strnatcmp</function>, except that the comparison is - not case sensitive. For more infomation see: Martin Pool's - <ulink url="&url.strnatcmp;">Natural Order String - Comparison</ulink> page. - </para> - <simpara> - Similar to other string comparison functions, this one returns - < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strncasecmp</function>, - <function>strnatcmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strncmp"> - <refnamediv> - <refname>strncmp</refname> - <refpurpose> - Binary safe string comparison of the first n characters - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strncmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>len</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>strcmp</function>, with the - difference that you can specify the (upper limit of the) number of - characters (<parameter>len</parameter>) from each string to be - used in the comparison. If any of the strings is shorter than - <parameter>len</parameter>, then the length of that string will be - used for the comparison. - </para> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, <function>strncasecmp</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.str-pad"> - <refnamediv> - <refname>str_pad</refname> - <refpurpose>Pad a string to a certain length with another string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_pad</function></funcdef> - <paramdef>string <parameter>input</parameter></paramdef> - <paramdef>int <parameter>pad_length</parameter></paramdef> - <paramdef>string - <parameter><optional>pad_string</optional></parameter></paramdef> - <paramdef>int - <parameter><optional>pad_type</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This functions pads the <parameter>input</parameter> string on - the left, the right, or both sides to the specifed padding - length. If the optional argument - <parameter>pad_string</parameter> is not supplied, the - <parameter>input</parameter> is padded with spaces, otherwise it - is padded with characters from <parameter>pad_string</parameter> - up to the limit. - </para> - - <para> - Optional argument <parameter>pad_type</parameter> can be - STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If - <parameter>pad_type</parameter> is not specified it is assumed to - be STR_PAD_RIGHT. - </para> - - <para> - If the value of <parameter>pad_length</parameter> is negative or - less than the length of the input string, no padding takes - place. - </para> - - <para> - <example> - <title><function>str_pad</function> example</title> - <programlisting role="php"> -$input = "Alien"; -print str_pad($input, 10); // produces "Alien " -print str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" -print str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.strpos"> - <refnamediv> - <refname>strpos</refname> - <refpurpose> - Find position of first occurrence of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strpos</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - <paramdef>int - <parameter><optional>offset</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the numeric position of the first occurrence of - <parameter>needle</parameter> in the - <parameter>haystack</parameter> string. Unlike the - <function>strrpos</function>, this function can take a full - string as the <parameter>needle</parameter> parameter and the - entire string will be used. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - <note> - <para> - 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: - <informalexample> - <programlisting role="php"> -// in PHP 4.0b3 and newer: -$pos = strpos ($mystring, "b"); -if ($pos === false) { // note: three equal signs - // not found... -} - -// in versions older than 4.0b3: -$pos = strpos ($mystring, "b"); -if (is_string ($pos) && !$pos) { - // not found... -} - </programlisting> - </informalexample> - </para> - </note> - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - The optional <parameter>offset</parameter> parameter allows you - to specify which character in <parameter>haystack</parameter> to - start searching. The position returned is still relative to the - the beginning of <parameter>haystack</parameter>. - </para> - <para> - See also <function>strrpos</function>, - <function>strrchr</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strrchr"> - <refnamediv> - <refname>strrchr</refname> - <refpurpose> - Find the last occurrence of a character in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strrchr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns the portion of - <parameter>haystack</parameter> which starts at the last - occurrence of <parameter>needle</parameter> and goes until the - end of <parameter>haystack</parameter>. - </para> - <para> - Returns false if <parameter>needle</parameter> is not found. - </para> - <para> - If <parameter>needle</parameter> contains more than one - character, the first is used. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - <example> - <title><function>Strrchr</function> example</title> - <programlisting role="php"> -// get last directory in $PATH -$dir = substr (strrchr ($PATH, ":"), 1); - -// get everything after last newline -$text = "Line 1\nLine 2\nLine 3"; -$last = substr (strrchr ($text, 10), 1 ); - </programlisting> - </example> - </para> - <para> - See also <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.str-repeat"> - <refnamediv> - <refname>str_repeat</refname> - <refpurpose>Repeat a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_repeat</function></funcdef> - <paramdef>string <parameter>input</parameter></paramdef> - <paramdef>int <parameter>multiplier</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>input_str</parameter> repeated - <parameter>multiplier</parameter> times. - <parameter>multiplier</parameter> has to be greater than 0. - </para> - <example> - <title><function>Str_repeat</function> example</title> - <programlisting role="php"> -echo str_repeat ("-=", 10); - </programlisting> - </example> - <para> - This will output "-=-=-=-=-=-=-=-=-=-=". - </para> - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </refsect1> - </refentry> - - <refentry id="function.strrev"> - <refnamediv> - <refname>strrev</refname> - <refpurpose>Reverse a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strrev</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter>, reversed. - </para> - </refsect1> - </refentry> - - <refentry id="function.strrpos"> - <refnamediv> - <refname>strrpos</refname> - <refpurpose> - Find position of last occurrence of a char in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strrpos</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>char <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the numeric position of the last occurrence of - <parameter>needle</parameter> in the - <parameter>haystack</parameter> string. Note that the needle in - this case can only be a single character. If a string is passed - as the needle, then only the first character of that string will - be used. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - <note> - <para> - 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: - <informalexample> - <programlisting role="php"> -// in PHP 4.0b3 and newer: -$pos = strrpos ($mystring, "b"); -if ($pos === false) { // note: three equal signs - // not found... -} - -// in versions older than 4.0b3: -$pos = strrpos ($mystring, "b"); -if (is_string ($pos) && !$pos) { - // not found... -} - </programlisting> - </informalexample> - </para> - </note> - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - See also <function>strpos</function>, - <function>strrchr</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strspn"> - <refnamediv> - <refname>strspn</refname> - <refpurpose> - Find length of initial segment matching mask - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strspn</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns the length of the initial segment of - <parameter>str1</parameter> which consists entirely of characters - in <parameter>str2</parameter>. - </simpara> - <para> - <informalexample> - <programlisting role="php"> -strspn ("42 is the answer, what is the question ...", "1234567890"); - </programlisting> - <para> - will return 2 as result. - </para> - </informalexample> - </para> - <simpara> - See also <function>strcspn</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strstr"> - <refnamediv> - <refname>strstr</refname> - <refpurpose>Find first occurrence of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strstr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns all of <parameter>haystack</parameter> from the first - occurrence of <parameter>needle</parameter> to the end. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - <note> - <para> - Note that this function is case-sensitive. For - case-insensitive searches, use <function>stristr</function>. - </para> - </note> - </para> - <para> - <example> - <title><function>Strstr</function> example</title> - <programlisting role="php"> -$email = 'sterling@designmultimedia.com'; -$domain = strstr ($email, '@'); -print $domain; // prints @designmultimedia.com - </programlisting> - </example> - </para> - <para> - See also <function>stristr</function>, - <function>strrchr</function>, <function>substr</function>, and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtok"> - <refnamediv> - <refname>strtok</refname> - <refpurpose>Tokenize string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtok</function></funcdef> - <paramdef>string <parameter>arg1</parameter></paramdef> - <paramdef>string <parameter>arg2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>strtok</function> is used to tokenize a string. That - is, if you have a string like "This is an example string" you - could tokenize this string into its individual words by using the - space character as the token. - <example> - <title><function>Strtok</function> example</title> - <programlisting role="php"> -$string = "This is an example string"; -$tok = strtok ($string," "); -while ($tok) { - echo "Word=$tok<br>"; - $tok = strtok (" "); -} - </programlisting> - </example> - </para> - <para> - Note that only the first call to strtok uses the string argument. - Every subsequent call to strtok only needs the token to use, as - it keeps track of where it is in the current string. To start - over, or to tokenize a new string you simply call strtok with the - string argument again to initialize it. Note that you may put - multiple tokens in the token parameter. The string will be - tokenized when any one of the characters in the argument are - found. - </para> - <para> - Also be careful that your tokens may be equal to "0". This - evaluates to false in conditional expressions. - </para> - <para> - See also <function>split</function> and - <function>explode</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtolower"> - <refnamediv> - <refname>strtolower</refname> - <refpurpose>Make a string lowercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtolower</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with all alphabetic - characters converted to lowercase. - </para> - <para> - 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. - </para> - <example> - <title><function>Strtolower</function> example</title> - <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; -$str = strtolower($str); -print $str; # Prints mary had a little lamb and she loved it so - </programlisting> - </example> - <para> - See also <function>strtoupper</function> - and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtoupper"> - <refnamediv> - <refname>strtoupper</refname> - <refpurpose>Make a string uppercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtoupper</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with all alphabetic - characters converted to uppercase. - </para> - <para> - 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. - </para> - <example> - <title><function>Strtoupper</function> example</title> - <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; -$str = strtoupper ($str); -print $str; # Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO - </programlisting> - </example> - <para> - See also <function>strtolower</function> - and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.str-replace"> - <refnamediv> - <refname>str_replace</refname> - <refpurpose> - Replace all occurrences of needle in haystack with str - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_replace</function></funcdef> - <paramdef>string <parameter>needle</parameter></paramdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function replaces all occurences of - <parameter>needle</parameter> in <parameter>haystack</parameter> - with the given <parameter>str</parameter>. If you don't need - fancy replacing rules, you should always use this function - instead of <function>ereg_replace</function>.</para> - <para> - <example> - <title><function>Str_replace</function> example</title> - <programlisting role="php"> -$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); - </programlisting> - </example> - </para> - <para> - This function is binary safe. - </para> - <note> - <para> - <function>Str_replace</function> was added in PHP 3.0.6, but was - buggy up until PHP 3.0.8. - </para> - </note> - <para> - See also <function>ereg_replace</function> and - <function>strtr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtr"> - <refnamediv> - <refname>strtr</refname> - <refpurpose>Translate certain characters</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtr</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>from</parameter></paramdef> - <paramdef>string <parameter>to</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function operates on <parameter>str</parameter>, translating - all occurrences of each character in <parameter>from</parameter> - to the corresponding character in <parameter>to</parameter> and - returning the result. - </para> - <para> - If <parameter>from</parameter> and <parameter>to</parameter> are - different lengths, the extra characters in the longer of the two - are ignored. - <example> - <title><function>Strtr</function> example</title> - <programlisting role="php"> -$addr = strtr($addr, "é´¨?, "aao"); - </programlisting> - </example> - </para> - <para> - <function>strtr</function> can be called with only two - arguments. If called with two arguments it behaves in a new way: - <parameter>from</parameter> then has to be an array that contains - string -> string pairs that will be replaced in the source - string. <function>strtr</function> will always look for the - longest possible match first and will *NOT* try to replace stuff - that it has already worked on. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$trans = array ("hello" => "hi", "hi" => "hello"); -echo strtr("hi all, I said hello", $trans) . "\n"; - </programlisting> - </informalexample> - This will show: "hello all, I said hi", - </para> - <note> - <simpara> - This feature (two arguments) was added in PHP 4.0. - </simpara> - </note> - <para> - See also <function>ereg_replace</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.substr"> - <refnamediv> - <refname>substr</refname> - <refpurpose>Return part of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>substr</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter>start</parameter></paramdef> - <paramdef>int - <parameter><optional>length</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Substr returns the portion of <parameter>string</parameter> - specified by the <parameter>start</parameter> and - <parameter>length</parameter> parameters. - </para> - <para> - If <parameter>start</parameter> is positive, the returned string - will start at the <parameter>start</parameter>'th position in - <parameter>string</parameter>, counting from zero. For instance, - in the string '<literal>abcdef</literal>', the character at - position <literal>0</literal> is '<literal>a</literal>', the - character at position <literal>2</literal> is - '<literal>c</literal>', and so forth. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", 1); // returns "bcdef" -$rest = substr ("abcdef", 1, 3); // returns "bcd" - </programlisting> - </informalexample> - </para> - <para> - If <parameter>start</parameter> is negative, the returned string - will start at the <parameter>start</parameter>'th character - from the end of <parameter>string</parameter>.</para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", -1); // returns "f" -$rest = substr ("abcdef", -2); // returns "ef" -$rest = substr ("abcdef", -3, 1); // returns "d" - </programlisting> - </informalexample> - </para> - <para> - If <parameter>length</parameter> is given and is positive, the - string returned will end <parameter>length</parameter> characters - from <parameter>start</parameter>. If this would result in a - string with negative length (because the start is past the end of - the string), then the returned string will contain the single - character at <parameter>start</parameter>. - </para> - <para> - If <parameter>length</parameter> is given and is negative, the - string returned will end <parameter>length</parameter> characters - from the end of <parameter>string</parameter>. If this would - result in a string with negative length, then the returned string - will contain the single character at - <parameter>start</parameter>. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", 1, -1); // returns "bcde" - </programlisting> - </informalexample> - </para> - <para> - See also <function>strrchr</function> and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.substr-count"> - <refnamediv> - <refname>substr_count</refname> - <refpurpose>Count the number of substring occurrences</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>substr_count</function></funcdef> - <paramdef>string <parameter>haystrack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>substr_count</function> returns the number of times the - <parameter>needle</parameter> substring occurs in the - <parameter>haystack</parameter> string. - </para> - - <para> - <example> - <title><function>substr_count</function> example</title> - <programlisting> -print substr_count("This is a test", "is"); // prints out 2 - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.substr-replace"> - <refnamediv> - <refname>substr_replace</refname> - <refpurpose>Replace text within a portion of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>substr_replace</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>string <parameter>replacement</parameter></paramdef> - <paramdef>int <parameter>start</parameter></paramdef> - <paramdef>int - <parameter><optional>length</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>substr_replace</function> replaces the part of - <parameter>string</parameter> delimited by the - <parameter>start</parameter> and (optionally) - <parameter>length</parameter> parameters with the string given in - <parameter>replacement</parameter>. The result is returned. - </para> - <para> - If <parameter>start</parameter> is positive, the replacing will - begin at the <parameter>start</parameter>'th offset into - <parameter>string</parameter>. - </para> - <para> - If <parameter>start</parameter> is negative, the replacing will - begin at the <parameter>start</parameter>'th character from the - end of <parameter>string</parameter>. - </para> - <para> - If <parameter>length</parameter> is given and is positive, it - represents the length of the portion of - <parameter>string</parameter> which is to be replaced. If it is - negative, it represents the number of characters from the end of - <parameter>string</parameter> at which to stop replacing. If it - is not given, then it will default to strlen( - <parameter>string</parameter> ); i.e. end the replacing at the - end of <parameter>string</parameter>. - </para> - <para> - <example> - <title><function>Substr_replace</function> example</title> - <programlisting role="php"> -<?php -$var = 'ABCDEFGH:/MNRPQR/'; -echo "Original: $var<hr>\n"; - -/* These two examples replace all of $var with 'bob'. */ -echo substr_replace ($var, 'bob', 0) . "<br>\n"; -echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; - -/* Insert 'bob' right at the beginning of $var. */ -echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; - -/* These next two replace 'MNRPQR' in $var with 'bob'. */ -echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; -echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; - -/* Delete 'MNRPQR' from $var. */ -echo substr_replace ($var, '', 10, -1) . "<br>\n"; -?> - </programlisting> - </example> - </para> - <para> - See also <function>str_replace</function> and - <function>substr</function>. - </para> - <note> - <simpara> - <function>Substr_replace</function> was added in PHP 4.0. - </simpara> - </note> - </refsect1> - </refentry> - - <refentry id="function.trim"> - <refnamediv> - <refname>trim</refname> - <refpurpose> - Strip whitespace from the beginning and end of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>trim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function strips whitespace from the start and the end of a - string and returns the stripped string. The whitespace - characters it currently strips are: "\n", "\r", "\t", "\v", "\0", - and a plain space. - </para> - <para> - See also <function>chop</function>, <function>rtrim</function> and - <function>ltrim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ucfirst"> - <refnamediv> - <refname>ucfirst</refname> - <refpurpose>Make a string's first character uppercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ucfirst</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Capitalizes the first character of <parameter>str</parameter> if - that character is alphabetic. - </para> - <para> - 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. - <example> - <title><function>Ucfirst</function> example</title> - <programlisting role="php"> -$text = 'mary had a little lamb and she loved it so.'; -$text = ucfirst ($text); // $text is now Mary had a little lamb - // and she loved it so. - </programlisting> - </example> - </para> - <para> - See also <function>strtoupper</function> and - <function>strtolower</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ucwords"> - <refnamediv> - <refname>ucwords</refname> - <refpurpose> - Uppercase the first character of each word in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ucwords</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Capitalizes the first character of each word in - <parameter>str</parameter> if that character is alphabetic. - <example> - <title><function>ucwords</function> example</title> - <programlisting role="php"> -$text = "mary had a little lamb and she loved it so."; -$text = ucwords($text); // $text is now: Mary Had A Little - // Lamb And She Loved It So. - </programlisting> - </example> - <note> - <simpara> - 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). - </simpara> - </note> - </para> - <para> - See also <function>strtoupper</function>, - <function>strtolower</function> and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - - <refentry id="function.wordwrap"> - <refnamediv> - <refname>wordwrap</refname> - <refpurpose> - Wraps a string to a given number of characters using a string - break character. - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>wordwrap</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>int - <parameter><optional>width</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>break</optional></parameter> - </paramdef> - <paramdef>int - <parameter><optional>cut</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Wraps the string <parameter>str</parameter> at the column number - specified by the (optional) <parameter>width</parameter> - parameter. The line is broken using the (optional) - <parameter>break</parameter> parameter. - </para> - <para> - <function>wordwrap</function> will automatically wrap at column - 75 and break using '\n' (newline) if <parameter>width</parameter> - or <parameter>break</parameter> are not given. - </para> - <para> - If the <parameter>cut</parameter> is set to 1, the string is - always wrapped at the specified width. So if you have a word - that is larger than the given width, it is broken appart. - (See second example). - <note> - <para> - The <parameter>cut</parameter> parameter was added in PHP 4.0.3. - </para> - </note> - </para> - <para> - <example> - <title><function>wordwrap</function> example</title> - <programlisting role="php"> -$text = "The quick brown fox jumped over the lazy dog."; -$newtext = wordwrap( $text, 20 ); - -echo "$newtext\n"; - </programlisting> - </example> - </para> - <para> - This example would display: - </para> - <para> - <informalexample> - <programlisting> -The quick brown fox -jumped over the lazy dog. - </programlisting> - </informalexample> - </para> - <para> - <example> - <title><function>wordwrap</function> example</title> - <programlisting role="php"> -$text = "A very long woooooooooooord."; -$newtext = wordwrap( $text, 8, "\n", 1); - -echo "$newtext\n"; - </programlisting> - </example> - </para> - <para> - This example would display: - </para> - <para> - <informalexample> - <programlisting> -A very -long -wooooooo -ooooord. - </programlisting> - </informalexample> - </para> - <para> - See also <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - - </reference> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: ---> +<reference id="ref.strings"> + <title>String functions</title> + <titleabbrev>Strings</titleabbrev> + <partintro> + <simpara> + ì´ë¤ í¨ìë 모ë ë¤ìí ë°©ë²ì¼ë¡ 문ìì´ì ë¤ë£¬ë¤. ì ê· íí ì¹ì ê³¼ URL í¸ë¤ë§ ì¹ì ììì¢ ë ë¤ìíê³ í¹ë³í í¨ìë¤ì ë§ë ë³¼ ì ìë¤. + </simpara> + <para> + ì´ë»ê² 문ìì´ì´ ì ì©ëê³ , í¹í ìì ë°ì´íì í°ë°ì´í ê·¸ë¦¬ê³ ìì¤ì¼ì´í ìíì¤(escape sequence)ì ì´ë¤ ê´ê³ê° ìëì§ë ì´ ë©ë´ì¼ì + <link linkend="language.types">Types</link>ì¹ì ì <link linkend="language.types.string">Strings</link>í¸ì 참조í기 ë°ëë¤. + </para> + </partintro> + <refentry id="function.addcslashes"> + <refnamediv> + <refname>AddCSlashes</refname> + <refpurpose>Cííë¡ ë¬¸ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>addcslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>charlist</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>charlist</parameter>íë¼ë¯¸í°ì ëì¤ë 문ì ìì ë°±ì¬ëì¬ë¥¼ ìì¹ìí¨ ë¬¸ìì´ì ë°ííë¤. + ì´ í¨ìë C ì¤íì¼ì <literal>\n</literal>, <literal>\r</literal>ë±ì ì´ì¤ì¼ì´í íê³ , 32 ë³´ë¤ ìê±°ë 126 ë³´ë¤ í° ASCII ì½ëë íì§ì ííì¼ë¡ ë³íëë¤. + ìí벳과 ì«ì를 ìì¤ì¼ì´íí ë 주ìíë¼. + "\0..\37"ê³¼ ê°ì´ í¹ë³í ë²ì를 <parameter>charlist</parameter>ìì ì§ì í ì ìì¼ë©°, ì´ë ASCII ì½ë 0ê³¼ 31 ì¬ì´ì 모ë 문ì를 ì´ì¤ì¼ì´í í ê²ì´ë¤. + <example> + <title> + <function>Addcslashes</function>ì ì</title> + <programlisting role="php"> +$escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); + </programlisting> + </example> + <note> + <simpara> + PHP4b3-dev ìì ì¶ê°ëìë¤.</simpara> + </note> + </para> + <para> + <function>stripcslashes</function>, + <function>stripslashes</function>, + <function>htmlspecialchars</function>, + <function>htmlspecialchars</function>, ê·¸ë¦¬ê³ + <function>quotemeta</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.addslashes"> + <refnamediv> + <refname>AddSlashes</refname> + <refpurpose>ì¬ëì¬ë¡ 문ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>addslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°ì´í° ë² ì´ì¤ 쿼리ì ê°ì´ ì¸ì©ë ë¶ë¶ ìì ë°±ì¬ëì¬ë¥¼ ë¶ì¬ ë°ííë¤. + ì´ë° 문ììë ììë°ì´í (<literal>'</literal>), í°ë°ì´í(<literal>"</literal>),ë°±ì¬ëì¬(<literal>\</literal>), ê·¸ë¦¬ê³ NULL(null byte)ì´ ìë¤. + </para> + <para> + <function>stripslashes</function>, + <function>htmlspecialchars</function>, ê·¸ë¦¬ê³ + <function>quotemeta</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.bin2hex"> + <refnamediv> + <refname>bin2hex</refname> + <refpurpose> + ìì§ ë°ì´í°ë¥¼ 16ì§ì ííì¼ë¡ ë³ííë¤. </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>bin2hex</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì 16ì§ì ííì ê°ë ASCII ì¤í¸ë§ì¼ë¡ ë°ííë¤. ë³íì íì´-ëë¸(high-nibble)ì ììì¼ë¡ íë ë°ì´í¸ ìì´ì¦(byte0wise) ë°©ìì¼ë¡ ì§íëë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.chop"> + <refnamediv> + <refname>Chop</refname> + <refpurpose>ë¤ë¶ë¶ì 공백ì ì ê±°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chop</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë´ë¼ì¸(newline)ì í¬í¨íë ë·ë¶ë¶ì 공백ì ì ê±°í 문ìì´ì ë°ííë¤. + <example> + <title> + <function>Chop</function>ì ì</title> + <programlisting role="php"> +$trimmed = chop ($line); + </programlisting> + </example> + </para> + <note> + <para> + <function>chop</function> ì ë§ì§ë§ 문ì를 ì ê±°íë í(Perl)ì ìì´ìì <parameter>chop()</parameter> í¨ìì ë¤ë¥´ë¤. + </para> + </note> + <para> + <function>trim</function>, <function>ltrim</function>, + <function>rtrim</function>, ê·¸ë¦¬ê³ <function>chop</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.chr"> + <refnamediv> + <refname>Chr</refname> + <refpurpose>í¹ì 문ì를 ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chr</function> + </funcdef> + <paramdef>int <parameter>ascii</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>ascii</parameter>ì ìí´ ì ìë 문ì를 ëíë´ë 문ì를 ë°ííë¤. + <example> + <title> + <function>Chr</function> ì ì</title> + <programlisting role="php"> +$str .= chr (27); /* $str ì ëì ìì¤ì¼ì´í 문ì를 ì¶ê°íë¤. */ + +/* ëë¡ ë¤ìê³¼ ê°ì ìê° ëì± ì ì©íë¤. */ + +$str = sprintf ("The string ends in escape: %c", 27); + </programlisting> + </example> + ì´ í¨ìë <function>ord</function> í¨ìì ëìëë¤. + <literal>%c</literal> í¬ë©§ì ì¬ì©í <function>sprintf</function>í¨ì를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.chunk-split"> + <refnamediv> + <refname>chunk_split</refname> + <refpurpose>Split a string into smaller chunks</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chunk_split</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>chunklen</optional> + </parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>end</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Can be used to split a string into smaller chunks which is useful + for e.g. converting <link linkend="function.base64-encode">base64_encode</link> output to + match RFC 2045 semantics. It inserts every + <parameter>chunklen</parameter> (defaults to 76) chars the string + <parameter>end</parameter> (defaults to "\r\n"). It returns the + new string leaving the original string untouched. + <example> + <title> + <function>Chunk_split</function> example</title> + <programlisting role="php"> +# format $data using RFC 2045 semantics + +$new_string = chunk_split (base64_encode($data)); + </programlisting> + </example> + This function is significantly faster than + <function>ereg_replace</function>. + <note> + <para> + This function was added in 3.0.6. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.convert-cyr-string"> + <refnamediv> + <refname>convert_cyr_string</refname> + <refpurpose> + í¤ë¦´ 문ì(Cyrillic character) ì ì ë¤ë¥¸ê²ì¼ë¡ ë³ííë¤. </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>convert_cyr_string</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>from</parameter> + </paramdef> + <paramdef>string <parameter>to</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 주ì´ì§ í¤ë¦´ 문ì ì íë를 ë¤ë¥¸ê²ì¼ë¡ ë³ííë¤. + <parameter>from</parameter>ê³¼ <parameter>to</parameter> ì¸ìë ìì¤ì íê² í¤ë¦´ 문ìì ì ëíë´ë íëì 문ìì´ë¤. + ì§ìëë íì ì ë¤ìê³¼ ê°ë¤: + <itemizedlist> + <listitem> + <simpara> + k - koi8-r + </simpara> + </listitem> + <listitem> + <simpara> + w - windows-1251 + </simpara> + </listitem> + <listitem> + <simpara> + i - iso8859-5 + </simpara> + </listitem> + <listitem> + <simpara> + a - x-cp866 + </simpara> + </listitem> + <listitem> + <simpara> + d - x-cp866 + </simpara> + </listitem> + <listitem> + <simpara> + m - x-mac-cyrillic + </simpara> + </listitem> + </itemizedlist> + </para> + </refsect1> + </refentry> + <refentry id="function.count-chars"> + <refnamediv> + <refname>count_chars</refname> + <refpurpose> + 문ìì´ì ì¬ì©ë ê¸ìì ê´í ì 보를 ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>count_chars</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef> + <parameter> + <optional>mode</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì ìë 0..255 ë°ì´í¸ì ëí ë¹ë ì를 ì¸ê³ , ê·¸ê²ì ë¤ìí ë°©ë²ì¼ë¡ ë°ííë¤. + ì íì ì¸ ë§¤ê°ë³ì <parameter>Mode</parameter> ë 0 ì¼ë¡ ê·¸ 기본ê°ì´ ì í´ì§ë¤. + <parameter>mode</parameter>ì ê°ì ë°ë¼ <function>count_chars</function> ì ë¤ìì¤ì íë를 ë°ííë¤: + <itemizedlist> + <listitem> + <simpara> + 0 - ë°ì´í¸-ê°(0..255)ì í¤ë¡ íê³ ë§¤ ë°ì´í¸ì ë¹ë를 ê°ì¼ë¡ íë ë°°ì´. + </simpara> + </listitem> + <listitem> + <simpara> + 1 - 0 ê³¼ ê°ì¼ë ë°ì´í¸-ê°ì ë¹ëê° 0ë³´í í° ê²ë¤ë§. + </simpara> + </listitem> + <listitem> + <simpara> + 2 - 0 ê³¼ ê°ì¼ë ë°ì´í¸-ê° ì´ 0 ì¸ ê²ë¤ë§. + </simpara> + </listitem> + <listitem> + <simpara> + 3 - ì¬ì©ë 모ë ë°ì´í¸-ê°ì í¬í¨íë 문ìì´ì´ ë°íëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + 4 - ì¬ì©ëì§ ìì ë³´ë ë°ì´í¸-ê°ì í¬í¨íë 문ìì´ì´ ë°íëë¤. + </simpara> + </listitem> + </itemizedlist> + </para> + <note> + <para> + ì´ í¨ìë PHP 4.0ë¶í° ì¶ê°ëìë¤. + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.crc32"> + <refnamediv> + <refname>crc32</refname> + <refpurpose>crc32 ë¤íìì 문ìì´ì ê³ì°íë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>crc32</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Generates the cyclic redundancy checksum polynomial of 32-bit lengths of + the <parameter>str</parameter>. This is usually used to validate the + integrity of data being trasmited. + </para> + <para> + <function>md5</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.crypt"> + <refnamediv> + <refname>crypt</refname> + <refpurpose>문ìì´ì DES-ìí¸í íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>crypt</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>salt</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>crypt</function>ì ì ëì¤ íì¤ì¸ <abbrev>DES</abbrev> ìí¸í 기ë²ì ì¬ì©íì¬ ë¬¸ìì´ì ìí¸í íë¤. + ì¸ìë¡ë ìí¸í ë 문ìì´ê³¼ ì íì ì¼ë¡ ìí¸íì ê¸°ë³¸ì´ ë ë 문ì salt 문ìì´ì´ ì¬ ì ìë¤. + ë ë§ì ì 보를 ìí´ ì ëì¤ì crypt í¨ìì ëí man page를 참조íë¼. + </para> + <simpara> + ë§ì½ salt ì¸ìê° ì£¼ì´ì§ì§ ìëë¤ë©´, PHPì ìí´ ë¬´ììë¡ ìì±ëë¤. + </simpara> + <simpara> + ëªëª ì´ìì²´ì ë íê°ì§ íì ì´ìì ìí¸í를 ì ê³µíë¤. ì¤ì ë¡ íì¤ DES ìí¸íë MD5ì 기ì´í ìí¸í ìê³ ë¦¬ì¦ì¼ë¡ ëì²´ë기ë íë¤. + ìí¸í íì ì slat ì¸ìì ìí´ ì ë°ëë¤. ì¸ì¤í¨ì, PHPë ìí¸í í¨ìì ê°ì© ì¬ë¶ë¥¼ ê²°ì íê³ , ë¤ë¥¸ ìí¸í íì ì ìí salt를 ì±íí ê²ì´ë¤. + ë§ì½ slatê° ì ê³µëì§ ìì¼ë©´, PHPë 기본ì ì¼ë¡ ëê¸ì DES salt를 ìë ìì±íê³ , ê·¸ë ì§ ìë¤ë©´ ì´ë MD5 í¸í saltê° ìì±ëë ê²½ì°ë¡ ìì¤í ì 기본 ìí¸í íì ì MD5ê° ëë¤. + PHPë CRYPT_SALT_LENGTH ë¼ë ìì를 ì¤ì íëë° ì´ë ìì¤í ì 2문ì salt를 ì ì©í ê²ì¸ì§ í¹ì ë 긴 12문ì MD5 salt를 ì ì©í ê²ì¸ì§ë¥¼ ìë ¤ì¤ë¤. + </simpara> + <simpara> + ë§ì½ ì ê³µë salt를 ì¬ì©íë¤ë©´, saltë íë²ë§ ìì±ëë¤ë ì ì 주ìíë¼. + ë§ì½ ì´ í¨ì를 ì¬ê·ì ì¼ë¡ í¸ì¶íë¤ë©´, ì´ë ê²ëª¨ìµ(appearance)ê³¼ ëì©ë©´ ì¢ ë íì¥ë ì미ìì 본ë¤ë©´ ë³´ììë ìí¥ì ë¼ì¹ ìë ìë¤. + </simpara> + <simpara> + 기본ì ì¸ DES ìí¸íì¸ <function>crypt</function>ë ì²ì ë 문ìê° salt ì¸ ë¬¸ìì´ì ì¶ë ¥íë¤. + </simpara> + <simpara> + crypt() í¨ìê° ë¤ìí ìí¸í íì ì ì§ìíë ìì¤í ìì, 주ì´ì§ íì ì´ ê°ë¥íëëì ë°ë¼ ë¤ì ììë 0 ì´ë 1 ë¡ ì§ì ëë¤. + </simpara> + <itemizedlist> + <listitem> + <simpara> + CRYPT_STD_DES - 2-문ì SALT를 ê°ì§ë 기본 DES ìí¸í + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_EXT_DES - 9문ì SALT 를 ê°ì§ë íì¥ë DES ìíí + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_MD5 - $1$ë¡ ììíë 12문ì SALT를 ê°ì§ë MD5 ìí¸í + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_BLOWFISH - $2$ë¡ ììíë 16문ì SALT를 ê°ë íì¥ë DES ìí¸í + </simpara> + </listitem> + </itemizedlist> + <simpara> + <function>crypt</function>ë one-way ìê³ ë¦¬ì¦ì ì¬ì©íë¯ë¡ decrypt í¨ìë ì¡´ì¬íì§ ìëë¤. + </simpara> + <simpara> + <function>md5</function> ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.echo"> + <refnamediv> + <refname>echo</refname> + <refpurpose>íë í¹ì ê·¸ ì´ìì 문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>echo</function> + </funcdef> + <paramdef>string <parameter>arg1</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>argn</optional>...</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + 무ë ì¸ì를 ì¶ë ¥íë¤. + </simpara> + <para> + <function>Echo</function> ë ì¤ì ë¡ í¨ìê° ìëë¤(ì´ë íëì ëê·ì§ ì¤í¸ëì³ì´ë¤.) ë°ë¼ì ì´ í¨ìì í¨ê» parantheses 를 ì¬ì©í íìê° ìë¤. + <example> + <title> + <function>Echo</function> ì</title> + <programlisting role="php"> +echo "Hello World"; + +echo "This spans +multiple lines. The newlines will be +output as well"; + +echo "This spans\nmultiple lines. The newlines will be\noutput as well."; + </programlisting> + </example> + </para> + <note> + <para> + ì¤ì ë¡ íë ì´ìì ì¸ì를 echo í¨ìì ì ë¬ íê³ ì íë¤ë©´, parentheses ë´ìì ì¸ì를 ê´í¸ë¡ ë«ì§ ë§ìì¼ íë¤. + In fact, if you want to pass more than one parameter to echo, + you must not enclose the parameters within parentheses. + </para> + </note> + <simpara> + <function>print</function>, + <function>printf</function>, ê·¸ë¦¬ê³ + <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.explode"> + <refnamediv> + <refname>explode</refname> + <refpurpose>문ìì´ì 주ì´ì§ 문ìì´ì 기주ì¼ë¡ ë¶ë¦¬íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>explode</function> + </funcdef> + <paramdef>string <parameter>separator</parameter> + </paramdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>limit</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + 문ìì´ì ë°°ì´ì ë°ííë©°, <parameter>string</parameter>ì ë¶ë¶ 문ìì´ë¡ íì±ë ê°ê°ì <parameter>separator</parameter>를 ê²½ê³ë¡ ëëì´ì§ë¤. + <parameter>limit</parameter>ê° ì§ì ë ê²½ì° ë°íë ë°°ì´ì ë§ì§ë§ ììê° ëë¨¸ì§ ë¬¸ìì´ì ì 체를 í¬í¨íë ìµë <parameter>limit</parameter>ê°ì ì리먼í¸ë¥¼ ê°ë ë°°ì´ì ë°ííë¤. + </para> + <note> + <para> + <parameter>limit</parameter> ì¸ìë PHP 4.0.1 ìì ì¶ê°ëìë¤. + </para> + </note> + <para> + <example> + <title> + <function>Explode</function> ì</title> + <programlisting role="php"> +$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; +$pieces = explode (" ", $pizza); + </programlisting> + </example> + </para> + <note> + <para> + ë¹ë¡ <function>implode</function> ë ê´ìµì ë°ë¼ ì¸ìì ìì¹ê° ì ìê° ë°ëì´ë íì©ì´ ëì§ë§, + <function>explode</function> ë ê·¸ë ì§ ëª»íë¤. + ë°ëì <parameter>separator</parameter> ê° <parameter>string</parameter> ì ìì ìì¹í´ì¼ë§ íë¤. + </para> + </note> + <para> + <function>split</function> ì + <function>implode</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.get-html-translation-table"> + <refnamediv> + <refname>get_html_translation_table</refname> + <refpurpose> + <function>htmlspecialchars</function> ì <function>htmlentities</function>ì ì¬ì©ë translation í ì´ë¸ì ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string + <function>get_html_translation_table</function> + </funcdef> + <paramdef>int <parameter>table</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>get_html_translation_table</function> ì <function>htmlspecialchars</function> ì <function>htmlentities</function>ì ë´ë¶ì ì¼ë¡ ì¬ì©ë translation í ì´ë¸ì ë°ííë¤. + ì¬ë¬ë¶ì´ ìíë í ì´ë¸ì ì§ì í ì ìëë¡ ëê°ì§ ìë¡ì´ ì ì(<parameter>HTML_ENTITIES</parameter>, <parameter>HTML_SPECIALCHARS</parameter>)ê° ìë¤. + ê·¸ë¦¬ê³ <function>htmlspecialchars</function> ì <function>htmlentities</function> í¨ìììì ë§ì°¬ê°ì§ë¡, ì íì ì¼ë¡ ë¹ì ì´ ì¬ì©íë quote_styleì ì§ì í ì ìë¤. + 기본ì ENT_COMPAT 모ëì´ë©°, <function>htmlspecialchars</function>ì ì¤ëª ëì´ ìë 모ë를 ì°¸ê³ í기 ë°ëë¤. + <example> + <title>Translation í ì´ë¸ ì</title> + <programlisting role="php"> +$trans = get_html_translation_table (HTML_ENTITIES); +$str = "Hallo & <Frau> & Krämer"; +$encoded = strtr ($str, $trans); + </programlisting> + </example> + <literal>$encoded</literal> ì ê°ì ë¤ìê³¼ ê°ë¤.: "Hallo &<sgmltag>amp</sgmltag>; &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; + &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". + </para> + <para> + ìë¡ì´ ë°©ë²ì ìë²ìì í기 ìí´ <function>array_flip</function>ì ì¬ì©íë ê²ì´ë¤. + <informalexample> + <programlisting role="php"> +$trans = array_flip ($trans); +$original = strtr ($str, $trans); + </programlisting> + </informalexample> + The content of <literal>$original</literal> would be: "Hallo & + <Frau> & Krämer". + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + <para> + ë¤ìì ì°¸ê³ íë¼ : <function>htmlspecialchars</function>, + <function>htmlentities</function>, <function>strtr</function>, + ê·¸ë¦¬ê³ <function>array_flip</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.get-meta-tags"> + <refnamediv> + <refname>get_meta_tags</refname> + <refpurpose> + íì¼ë¡ ë¶í° 모ë ë©í íê·¸ ë´ì© ìì±ì ë°°ì´ë¡ ì¶ì¶íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_meta_tags</function> + </funcdef> + <paramdef>string <parameter>filename</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>use_include_path</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>filename</parameter>ì íì¼ì ì´ê³ <meta>ì í´ë¹íë ë¶ë¶ì ì¤ë¨ìë¡ í´ìíë¤. + <example> + <title>Meta Tags Example</title> + <programlisting role="html"> +<meta name="author" content="name"> +<meta name="tags" content="php3 documentation"> +</head> <!-- íì±ì´ ì¬ê¸°ì ë©ì¶ë¤. --> + </programlisting> + </example> + (ë¼ì¸ 구ë¶ì ëí´ ì£¼ìíë¼ - PHP ì ë ¥ì ëí íì±ì í ë íì¬ ìì¤í ì í¨ì를 ì¬ì©íë¯ë¡ Mac ììì íì¼ì´ Unix ììë ì ëë¡ ëìíì§ ìì ê²ì´ë¤). + </para> + <para> + ì´ë¦ ìì±ì ê´í ê°ì í¤ê° ëë©°, ì½í í¸ ìì±ì ê´í ê°ì ë°íëë ë°°ì´ì ê°ì´ ëì´ ë°°ì´ì ë¤ë£¨ê±°ë ê°ì ì ê·¼íëë° ìì½ê² 기본ì ì¸ ë°°ì´ í¨ì를 ì¬ì©í ì ìë¤. + name ìì± ê°ì ìë í¹ì 문ìë '_'ë¡ ì¹íëë©°, ë머ì§ë ì문ìë¡ ë³íëë¤. + </para> + <para> + <parameter>use_include_path</parameter> ì 1 ë¡ ì¸í íë©´, PHP ë íì¼ì 기본 include ê²½ë¡ìì ì°¾ì ì´ë ¤ê³ í ê²ì´ë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.hebrev"> + <refnamediv> + <refname>hebrev</refname> + <refpurpose> + ë ¼ë¦¬ì ì¸ í¤ë¸ë£¨ í ì¤í¸ë¥¼ ììë³¼ ì ìë í ì¤í¸ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>hebrev</function> + </funcdef> + <paramdef>string <parameter>hebrew_text</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>max_chars_per_line</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì íì ì¸ì <parameter>max_chars_per_line</parameter>ë ë¼ì¸ë¹ ì¶ë ¥ë ìµë ê¸ì ì를 ëíë¸ë¤. + ì´ í¨ìë breaking words를 무ìíë ¤ê³ íë¤.(The function tries to avoid breaking words.) + </para> + <para> + <function>hebrevc</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.hebrevc"> + <refnamediv> + <refname>hebrevc</refname> + <refpurpose> + ê°í 문ì를 í¬í¨í í¤íë¥ í ì¤í¸ë¥¼ ë³¼ ì ìë í ì¤í¸ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>hebrevc</function> + </funcdef> + <paramdef>string <parameter>hebrew_text</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>max_chars_per_line</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ê°í문ì(\n) 를 "<br>\n" ë¡ ë°ê¾¼ë¤ë ê²ì ì ì¸íë©´ <function>hebrev</function>ì ë¹ì·íë¤. + ì íì ì¸ ë§¤ê°ë³ì <parameter>max_chars_per_line</parameter>ë ì¶ë ¥ë ë¼ì¸ë¹ ìµëì 문ì ì를 ê°ë¦¬í¨ë¤. + ì´ í¨ìë breaking words를 무ìíë¤.(The function tries to avoid breaking words.) + </para> + <para> + <function>hebrev</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.htmlentities"> + <refnamediv> + <refname>htmlentities</refname> + <refpurpose> + í´ë¹ëë 모ë 문ì를 HTML ìí°í° ííë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>htmlentities</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë HTML ìí°í°ì í´ë¹íë 모ë 문ìê° HTML ìí°ëë¡ ë³íëë¤ë ì ì ì ì¸íê³ ë + <function>htmlspecialchars</function> ì 모ë ë°©ë©´ìì ì¼ì¹íë¤. + <function>htmlspecialchars</function>ì ë¹ì·íê² ì íì ì¸ ëë²ì§¸ì ì¸ì를 ì·¨íëë° ì´ë + ìì ë°ì´íì í° ë°ì´í를 ì´ë»ê² ë¤ë£°ê¹ë¥¼ ì§ìíë¤. + <constant>ENT_COMPAT</constant>(기본ê°)ì í°ë°ì´í ë§ì ê°ê¾¸ê³ ìì ë°ì´íë ë´ë²ë ¤ ëë©°, + <constant>ENT_QUOTES</constant>ë ìì ë°ì´íì í° ë°ì´í 모ë를 ë°ê¾¸ê³ , + <constant>ENT_NOQUOTES</constant>ë ìì ë°ì´íì í° ë°ì´í 모ë를 ë°ê¾¸ì§ ìê³ ê·¸ëë¡ ë´ë²ë ¤ ëë¤. + </para> + <para> + íì¬ ISO-8859-1 문ì ì ì´ ì¬ì©ëë¤. + ì íì¸ìì¸ ëë²ì§¸ ì¸ìë PHP 3.0.17 ê³¼ PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + <para> + <function>htmlspecialchars</function> ì + <function>nl2br</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.htmlspecialchars"> + <refnamediv> + <refname>htmlspecialchars</refname> + <refpurpose> + í¹ì 문ì를 HTML ìí°í° ííë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>htmlspecialchars</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ë¤ 문ììì HTML ë´ì´ì í¹ë³í ì¤ìì±ì ê°ì§ë©°, ê·¸ 문ìì ì미를 ë³´ì¡´íë ¤ë©´, HTML ìí°í°ë¡ì ííëì´ì ¸ì¼ íë¤. + ì´ í¨ìë ì´ë ê² ë§ë¤ì´ì§ ë³íë 문ìì´ì ë°ííë¤-ì´ë¬í ë²ìì ì¹ íë¡ê·¸ëë°ìì ë§¤ì° ì ì©íë¤. + ë§ì½ 모ë HTML 문ì ìí°í°ë¥¼ ë²ìí íìê° ìë¤ë©´ <function>htmlentities</function>를 ëì ì¬ì©í기 ë°ëë¤. + </para> + <simpara> + ì´ í¨ìë ê²ìíì´ë ë°©ëª ë¡ ë±ì íë¡ê·¸ë¨ìì ì¬ì©ìê° HTML ì í¬í¨íë í ì¤í¸ì ì¬ì©ì ë§ëë° ì ì©íë¤. + ì íì ì¸ ëë²ì§¸ ì¸ì quote_style ì ìì ë°ì´íì í° ë°ì´í를 ì´ë»ê² ì¬ì©í ì§ë¥¼ ë§í´ì¤ë¤. + 기본 모ëì¸ ENT_COMPAT ì ë¨ì§ í° ë°ì´íë§ ë³ííê³ ìì ë°ì´íë ê·¸ëë¡ ë´ë²ë ¤ ëë¤. + ENT_QUOTES ê° ì§ì ëë©´, ìì ë°ì´íì í° ë°ì´í 모ë를 ë²ìíë©°, + ENT_NOQUOTESë ìì ë°ì´íì í° ë°ì´í 모ë를 ë²ìíì§ ìëë¤. + </simpara> + <para> + ë²ìì´ ì´ë£¨ì´ì§ë ííë ë¤ìê³¼ ê°ë¤ : + <itemizedlist> + <listitem> + <simpara> + '&' (ì°í¼ìë) ë '&amp;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '"' (í°ë°ì´í) ë ENT_NOQUOTES ì´ ì§ì ëì´ ìì§ ìì ë '&quot;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ''' (ììë°ì´í) ë¨ì§ ENT_QUOTES ë§ ì§ì ê´´ì´ ìì ë '&#039;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '<' (ë³´ë¤ ìë¤) ë '&lt;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '>' (ë³´ë¤ í¬ë¤) ë '&gt;' ì´ ëë¤. + </simpara> + </listitem> + </itemizedlist> + <example> + <title> + <function>htmlspecialchars</function> ì</title> + <programlisting role="php"> +$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); + </programlisting> + </example> + </para> + <para> + ì´ í¨ìë ìì ëª ìë ê±° ì´ì¸ìë ì´ë¤ ê²ë ë²ìíì§ ìëë¤ë ê²ì ëª ì¬íë¼. + ìì í ìí°í° ë²ìì ìí´ìë <function>htmlentities</function>ì ì°¸ê³ íë¼. + ëí ì íì ì¸ ëë² ì§¸ ì¸ì ë PHP 3.0.17 ê³¼ PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + <para> + <function>htmlentities</function> ì + <function>nl2br</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.implode"> + <refnamediv> + <refname>implode</refname> + <refpurpose>문ìì´ë¡ í¨ì ì리먼í¸ë¥¼ ì°ê²°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>implode</function> + </funcdef> + <paramdef>string <parameter>glue</parameter> + </paramdef> + <paramdef>array <parameter>pieces</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ê°ê°ì ë°°ì´ ìì ì¬ì´ì ì¤í¸ë§ì í¬í¨íë 문ìì´ì ë°ííë¤. + <example> + <title> + <function>Implode</function> example</title> + <programlisting role="php"> +$colon_separated = implode (":", $array); + </programlisting> + </example> + </para> + <note> + <para> + <function>implode</function> ë ê´ìµì ë°ë¼ ì¸ìì ìì¹ê° ì ìê° ë°ëì´ë íì©ì´ ëì§ë§, + <function>explode</function> ìì í¼ëì ë§ê¸° ìí´ ì´ ë¬¸ìì ìì ë ììë¡ ì¸ì를 ì¬ì©íë ê²ì ê¶ì¥íë¤. + </para> + </note> + <simpara> + <function>explode</function>, <function>join</function>, + ê·¸ë¦¬ê³ <function>split</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.join"> + <refnamediv> + <refname>join</refname> + <refpurpose>문ìì´ë¡ ë°°ì´ì ìì를 ì°ê²°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>join</function> + </funcdef> + <paramdef>string <parameter>glue</parameter> + </paramdef> + <paramdef>array <parameter>pieces</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>join</function> ì <function>implode</function> ì ë³ì¹ì´ë©°, 모ë ë©´ìì ì¼ì¹íë¤. + </simpara> + <simpara> + <function>explode</function>, <function>implode</function>, + ê·¸ë¦¬ê³ <function>split</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.levenshtein"> + <refnamediv> + <refname>levenshtein</refname> + <refpurpose> + ë 문ìì´ ê°ì Levenshtein ëì¤í´ì¤ë¥¼ ê³ì°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>cost_ins</parameter> + </paramdef> + <paramdef>int <parameter>cost_rep</parameter> + </paramdef> + <paramdef>int <parameter>cost_del</parameter> + </paramdef> + </funcprototype> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>function <parameter>cost</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns the Levenshtein-Distance between the + two argument strings or -1, if one of the argument strings + is longer than the limit of 255 characters (255 should be + more than enough for name or dictionary comparison, and + nobody serious would be doing genetic analysis with PHP). + </para> + <para> + The Levenshtein distance is defined as the minimal number of + characters you have to replace, insert or delete to transform + <parameter>str1</parameter> into <parameter>str2</parameter>. + The complexity of the algorithm is <literal>O(m*n)</literal>, + where <literal>n</literal> and <literal>m</literal> are the + length of <parameter>str1</parameter> and + <parameter>str2</parameter> (rather good when compared to + <function>similar_text</function>, which is O(max(n,m)**3), + but still expensive). + </para> + <para> + In its simpelest form the function will take only the two + strings as parameter and will calculate just the number of + insert, replace and delete operations needed to transform + <parameter>str1</parameter> into <parameter>str2</parameter>. + </para> + <para> + A second variant will take three additional parameters that + define the cost of insert, replace and delete operations. + This is more general and adaptive than variant one, but not + as efficient. + </para> + <para> + The third variant (which is not implemented yet) will be + the most general and adaptive, but also the slowest alternative. + It will call a user-supplied function that will determine the + cost for every possible operation. + </para> + <para> + The user-supplied function will be called with the following + arguments: + <itemizedlist> + <listitem> + <simpara> + operation to apply: 'I', 'R' or 'D' + </simpara> + </listitem> + <listitem> + <simpara> + actual character in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + actual character in string 2 + </simpara> + </listitem> + <listitem> + <simpara> + position in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + position in string 2 + </simpara> + </listitem> + <listitem> + <simpara> + remaining characters in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + remaining characters in string 2 + </simpara> + </listitem> + </itemizedlist> + The user-supplied function has to return a positive integer + describing the cost for this particular operation, but it + may decide to use only some of the supplied arguments. + </para> + <para> + The user-supplied function approach offers the possibility to + take into account the relevance of and/or difference between + certain symbols (characters) or even the context those symbols + appear in to determine the cost of insert, replace and delete + operations, but at the cost of loosing all optimizations done + regarding cpu register utilization and cache misses that have + been worked into the other two variants. + </para> + <para> + See also <function>soundex</function>, + <function>similar_text</function> + and <function>metaphone</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.ltrim"> + <refnamediv> + <refname>ltrim</refname> + <refpurpose> + 문ìì´ ììë¶ë¶ìì 공백ì ì ê±°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ltrim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 문ìì´ ìë¶ë¶ì 공백ì ì ê±°íë©°, 공백 ì ê±°ë 문ìì´ì ë°ííë¤. + ì¼ë°ì ì¼ë¡ ì ê±°ëë 문ìë ë¤ìê³¼ ê°ë¤ : "\n", "\r", "\t", "\v", "\0", ê·¸ë¦¬ê³ ê³µë°± + </para> + <para> + <function>chop</function>, <function>rtrim</function>, ê·¸ë¦¬ê³ + <function>trim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.md5"> + <refnamediv> + <refname>md5</refname> + <refpurpose>문ìì´ì md5 í´ì¬ë¥¼ ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>md5</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. MD5 Message-Digest Algorithm</ulink>ì ì¬ì©íì¬ + <parameter>str</parameter>ì MD5 í´ì¬ë¥¼ ê³ì°íë¤. + </para> + <para> + <function>crc32</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.metaphone"> + <refnamediv> + <refname>Metaphone</refname> + <refpurpose>문ìì´ì ë©íí° í¤(metaphone key) 를 ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>metaphone</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì ë©íí° í¤(metaphone key) 를 ê³ì°íë¤. + </para> + <para> + <function>soundex</function>ì ë¹ì·íê² ë©íí°(metaphone)ì ì ì¬í ë°ìì ë¨ì´ì ëí ëì¼í í¤ë¥¼ ìì±íë¤. + ì´ í¨ìë ìì´ ë°ìì 기본 ë²ì¹ì ì¬ì©íë<function>soundex</function>ë³´ë¤ í¨ì¬ ì ííë¤. + ë©íí° ìì± í¤ë ê°ë³ê¸¸ì´ì´ë¤. + </para> + <para> + ë©íí°ì Lawrence Philips <lphilips@verity.com>ì ìí´ ê°ë°ëìë¤. + ì´ë ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995]ì ìì ëì´ ìë¤. + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.nl2br"> + <refnamediv> + <refname>nl2br</refname> + <refpurpose>ë´ë¼ì¸ì HTML ë¼ì¸ ë¸ë ì´í¬(<BR>)ë¡ ë³ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>nl2br</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë´ ë¼ì¸ ì ì '<BR>' ê° ì½ì ë <parameter>string</parameter>ì ë°ííë¤. + </para> + <para> + <function>htmlspecialchars</function>, + <function>htmlentities</function> ê·¸ë¦¬ê³ + <function>wordwrap</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ord"> + <refnamediv> + <refname>Ord</refname> + <refpurpose>문ìì ASCII ê°ì ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ord</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 첫ë²ì§¸ 문ìì ASCII ê°ì ë°ííë¤. + ì´ í¨ìë <function>chr</function>ì ë³´ì¶©íë¤. + <example> + <title> + <function>Ord</function> ì</title> + <programlisting role="php"> +if (ord ($str) == 10) { + echo "The first character of \$str is a line feed.\n"; +} + </programlisting> + </example> + </para> + <simpara> + <function>chr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.parse-str"> + <refnamediv> + <refname>parse_str</refname> + <refpurpose>문ìì´ì ë³ìë¡ íì±íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>parse_str</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>array <parameter> + <optional>arr</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + 문ìì´ <parameter>str</parameter>ì ë§ì¹ URLì íµí´ ì¨ ì§ì문ì¸ê² ì²ë¼ íì±íê³ + ì ì ë³ìë¡ ë³ì를 ì§ì íë¤. + ë§ì½ ëë²ì§¸ 매ê°ë³ì <parameter>arr</parameter>ì´ ì¡´ì¬íë©´, + ë³ìë <parameter>arr</parameter>ì´ë¦ì ê°ë ë°°ì´ì ììë¡ ì ì¥ëë¤. + </para> + <para> + <example> + <title> + <function>parse_str</function>ì ì¬ì© + </title> + <programlisting role="php"> +$str = "first=value&second[]=this+works&second[]=another"; +parse_str($str); +echo $first; /* "value" 를 ì¶ë ¥ */ +echo $second[0]; /* "this works" 를 ì¶ë ¥ */ +echo $second[1]; /* "another" 를 ì¶ë ¥ */ + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.print"> + <refnamediv> + <refname>print</refname> + <refpurpose>문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>print</function> + </funcdef> + <paramdef>string <parameter>arg</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>arg</parameter>ì ì¶ë ¥íë¤. + </simpara> + <simpara> + <function>echo</function>, <function>printf</function>, + ê·¸ë¦¬ê³ <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.printf"> + <refnamediv> + <refname>printf</refname> + <refpurpose>í¬ë©§ë 문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>printf</function> + </funcdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>mixed + <parameter> + <optional>args</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>format</parameter>ì ë°ë¼ ì¶ë ¥ì ë§ë¤ì´ ë´ë©°, ì´ë <function>sprintf</function>를 ìí 문ìì ì¤ëª ëì´ ìë¤. + </simpara> + <simpara> + <function>print</function>, <function>sprintf</function>, + <function>sscanf</function>, <function>fscanf</function>, + ê·¸ë¦¬ê³ <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.quoted-printable-decode"> + <refnamediv> + <refname>quoted_printable_decode</refname> + <refpurpose> + ì¸ì©ë ì¶ë ¥ê°ë¥í 문ìì´ì 8ë¹í¸ 문ìì´ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string + <function>quoted_printable_decode</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + ì´ í¨ìë ëì½ëë ì¸ì©ë ì¶ë ¥ ê°ë¥í 문ìì´ì í´ë¹íë 8ë¹í¸ ë°ì´ë리 문ìì´ì ë°ííë¤. + ì´ í¨ìë ìëíëë° IMAP 모ëì´ íì ìë¤ë ì ì ì ì¸íë©´, <function>imap_qprint</function>ì ì ì¬íë¤. + </simpara> + </refsect1> + </refentry> + <refentry id="function.quotemeta"> + <refnamediv> + <refname>quotemeta</refname> + <refpurpose>ë©í 문ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>quotemeta</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <screen>. \\ + * ? [ ^ ] ( $ )</screen>ì 문ìë¤ ì ì + <parameter>str</parameter>ì ë°±ì¬ëì¬ ë¬¸ì(<literal>\</literal>) 를 ì¬ì©í ë²ì ¼ì ë°ííë¤. + </para> + <simpara> + <function>addslashes</function>, + <function>htmlentities</function>, + <function>htmlspecialchars</function>, + <function>nl2br</function>, ê·¸ë¦¬ê³ + <function>stripslashes</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.rtrim"> + <refnamediv> + <refname>rtrim</refname> + <refpurpose>문ìì´ ëì 공백ì ì ê±°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcdef>string <function>rtrim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcsynopsis> + <para> + ì¸ìë¡ ëì´ì¨ 문ìì´ìì ë´ë¼ì¸ì í¬í¨íë 문ìì´ ëì 공백ì ì ê±°í 문ìì´ì ë°í íë©°, + ì´ë <function>chop</function>ì ë³ì¹ì´ë¤. + <example> + <title> + <function>rtrim</function> ì</title> + <programlisting role="php"> +$trimmed = rtrim ($line); + </programlisting> + </example> + </para> + <para> + <function>trim</function>, <function>ltrim</function>, ê·¸ë¦¬ê³ + <function>rtrim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.sscanf"> + <refnamediv> + <refname>sscanf</refname> + <refpurpose>í¬ë©§ì´ ë°ë¼ì ì ë ¥ì 문ìì´ë¡ë¶í° íì±íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>sscanf</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>var1</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>sscanf</function> í¨ìë <function>printf</function>ì ì ë ¥ ì ì¬ì±ì ê°ì§ë¤. + <function>Sscanf</function>sms <parameter>str</parameter> 문ìì´ë¡ ë¶í° ì ë ¥ì ì½ì´ + í¹ì í <parameter>format</parameter> ì ë°ë¼ ì¸í°ë½í¸íë¤. + - <function>Sscanf</function> reads from the string <parameter>str</parameter> + and interprets it according to the specified <parameter>format</parameter>. + ë§ì½ ëê°ì 매ê°ë³ìë§ì´ ì´ í¨ìë¡ ì ë¬ëë¤ë©´, íì±ë ê°ì ë°°ì´ë¡ì ë°íëë¤. + <example> + <title> + <function>Sscanf</function> ì</title> + <programlisting role="php"> +// ìë¦¬ì¼ ë²í¸ë¥¼ ì»ëë¤. +$serial = sscanf("SN/2350001","SN/%d"); +// ì ì¡°ì¼ì ì§ì íë¤. +$mandate = "January 01 2000"; +list($month, $day, $year) = sscanf($mandate,"%s %d %d"); +echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; + </programlisting> + </example> + ì íì ì¸ ë§¤ê°ë³ìê° ì ë¬ëë©´, í¨ìë í ë¹ë ê°ì ëí ì를 ë°ííë¤. + ì íì ì¸ ë§¤ê°ë³ìë ë°ëì 참조ì ìí´ ì ë¬ëì´ì¼ íë¤. + <example> + <title> + <function>Sscanf</function> - ì íì ì¸ ë§¤ê°ë³ì ì¬ì©í기</title> + <programlisting role="php"> +// ìê° ì 보를 ì»ê³ DocBookì ì¸í¸ë¦¬ë¥¼ íì±ííë¤. +$auth = "24\tLewis Carroll"; +$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); +echo "<author id='$id'> + <firstname>$first</firstname> + <surname>$last</surname> +</author>\n"; + </programlisting> + </example> + </para> + <para> + <function>fscanf</function>, <function>printf</function>, + ê·¸ë¦¬ê³ <function>sprintf</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.setlocale"> + <refnamediv> + <refname>setlocale</refname> + <refpurpose>ì§ìì 보를 ì§ì íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>setlocale</function> + </funcdef> + <paramdef>string <parameter>category</parameter> + </paramdef> + <paramdef>string <parameter>locale</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>Category</parameter>ë ì§ì ì¸í ì ìí´ ìí¥ì ë°ë í¨ìì ë²ì£¼ë¥¼ í¹ì±í íë 문ìì´ì´ë¤ : + <itemizedlist> + <listitem> + <simpara> + LC_ALL - ì´í ëì¤ë 모ë ê²ì ìí´ + </simpara> + </listitem> + <listitem> + <simpara> + LC_COLLATE - 문ìì´ ë¹êµë¥¼ ìí¨ - íµìì ì¼ë¡ PHPììë ì¤í»ì¸ì§ ìëë¤ + </simpara> + </listitem> + <listitem> + <simpara> + LC_CTYPE - <function>strtoupper</function>ì ê°ì´ 문ì ì ííì ë³íì ìí´. + </simpara> + </listitem> + <listitem> + <simpara> + LC_MONETARY - localeconv() 를 ìí´ - íµìì ì¼ë¡ PHPììë ì¤í»ì¸ì§ ìëë¤ + </simpara> + </listitem> + <listitem> + <simpara> + LC_NUMERIC - ìì§ êµ¬ë¶ì를 ìí´ + </simpara> + </listitem> + <listitem> + <simpara> + LC_TIME - <function>strftime</function>ì í¨ê» ë ìì ìê° í매í ì ìí´ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + ë§ì½ <parameter>locale</parameter>ì´ ë¹ ë¬¸ìì´ <literal>""</literal>ì¼ ê²½ì° + ë¡ì¼ì¼ ì´ë¦ì ì ì¹´íê³ ë¦¬ì ì´ë¦ê³¼ ê°ì ì´ë¦ì ê°ë íê²½ë³ìë "LANG"ì¼ë¡ ë¶í° ì¸í ëë¤. + </para> + <para> + ë§ì½ ë¡ì¼ì¼ì´ 0 ì´ê±°ë 문ì <literal>"0"</literal>ì¼ ê²½ì°, + ë¡ì¼ì¼ ì¸í ì ìí¥ì ë°ì§ ìê³ ë¨ì§ íì¬ì ì¤ì ë§ì´ ë°íëë¤. + </para> + <para> + Setlocale ì ìë¡ì´ íì¬ ë¡ì¼ì¼ì´ë, ë¡ì¼ì¼ 기ë¥ì´ íë«í¼ì´ì ìíëì§ ìê±°ë, + í¹ì ë¡ì¼ì¼ì´ ì¡´ì¬íì§ ìê±°ë í¹ì ì¹´í ê³ ë¦¬ ì´ë¦ì´ ì í¨íì§ ìì ê²½ì° ê±°ì§ì ë°ííë¤. + ì í¨íì§ ìì ì¹´í ê³ ë¦¬ ì´ë¦ ìì ê²½ê³ ë©ìì§ë¥¼ ì¼ê¸°ìí¨ë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.similar-text"> + <refnamediv> + <refname>similar_text</refname> + <refpurpose> + ë 문ìì´ ê°ì ì ì¬ì±ì ê³ì°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>similar_text</function> + </funcdef> + <paramdef>string <parameter>first</parameter> + </paramdef> + <paramdef>string <parameter>second</parameter> + </paramdef> + <paramdef>double + <parameter> + <optional>percent</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ë Oliver [1993]ì ì¤ëª ë ê²ì²ë¼ ë 문ìì´ ê°ì ì ì¬ì±ì ê³ì°íë¤. + ì´ ìíì Oliver's ìì¬ì½ëìì ì²ë¼ ì¤íì ì¬ì©íë ê²ì´ ìëë¼, + ì ì²´ íë¡ì¸ì¤ìì ìë를 ëì´ê±°ë ëë¦¬ê² í ìë ìë ì¬ê·ì ì¸ í¸ì¶ì + ì¬ì©í¨ì 주ìíë¼. + ëí ì´ ìê³ ë¦¬ì¦ì ë³µì¡ëë O(N**3) ì´ë©° Nì ê°ì¥ 긴 문ìì´ì 길ì´ë¥¼ ëíë¸ë¤. + </para> + <para> + ì¸ë²ì§¸ ì¸ìë 참조ì ìí ì ë¬ì í¨ì¼ë¡ì, <function>similar_text</function>ë + ë 문ìì´ê°ì ì ì¬ì±ì í¼ì¼í°ì§ë¡ ê³ì°í ì ìë¤. + ì´ í¨ìë ë 문ìì´ì 매ì¹íë 문ì ì를 리í´íë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.soundex"> + <refnamediv> + <refname>soundex</refname> + <refpurpose>문ìì´ì soundex í¤ë¥¼ ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>soundex</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì soundexí¤ë¥¼ ê³ì°íë¤. + </para> + <para> + Soundex í¤ë ë¨ì´ì ë°ìì´ ê°ì¼ë©´, ê°ì soundex í¤ë¥¼ ìì±íë í¹ì±ì ê°ì§ë¤. + ê·¸ë¦¬ê³ ì´ë¡ì¸í´ ë°ì´íë² ì´ì¤ìì ë°ìì ìì§ë§ ì¤í ì 모르ë ë¨ì´ë¥¼ ì½ê² ì°¾ì ì ê° ìë¤. + ì´ soundex í¨ìë ìíë²³ 문ìë¡ ììíë 4 문ì 길ì´ì 문ìì´ì ë°ííë¤. + </para> + <para> + ì´ë ê² í¹ë³í soundex í¨ìë "The Art Of Computer Programming, vol. 3: Sorting And + Searching", Addison-Wesley (1973), pp. 391-392 ìì Donald Knuth ì ìí´ ê¸°ì ëìë¤. + </para> + <para> + <example> + <title>Soundex ì</title> + <programlisting role="php"> +soundex ("Euler") == soundex ("Ellery") == 'E460'; +soundex ("Gauss") == soundex ("Ghosh") == 'G200'; +soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; +soundex ("Knuth") == soundex ("Kant") == 'K530'; +soundex ("Lloyd") == soundex ("Ladd") == 'L300'; +soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.sprintf"> + <refnamediv> + <refname>sprintf</refname> + <refpurpose>í¬ë©§ë 문ìì´ì ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>sprintf</function> + </funcdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>mixed + <parameter> + <optional>args</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + í¬ë§· 문ìì¸<parameter>format</parameter>ì ë°ë¼ì ìì±ë 문ìì´ì ë°ííë¤. + <parameter>format</parameter>. + </simpara> + <simpara> + í¬ë§· ì¤í¸ë§ì 0 í¹ì ë¤ë¥¸ ì§ìë¬¸ì´ ì¬ ì ìë¤: + ì§ì ê²°ê³¼ë¡ ë³µì¬ëë ì¼ë°ì ì¸ ë¬¸ì(<literal>%</literal>ì í¬í¨íì¬)ì + <emphasis>ë³í í¹ì 문ì(conversion specifications)</emphasis>, + ê°ê°ì ìì ì 매ê°ë³ì를 í¨ì¹íë 결과를 ëíë¸ë¤. + ì´ë <function>sprintf</function> ì <function>printf</function> ëëììë ë§ì°¬ê°ì§ì´ë¤. + </simpara> + <para> + ê°ê° ë³í í¹ì문ìë í¼ì¼í¸ 기í¸(<literal>%</literal>) ë¡ êµ¬ì±ëë©°, + ì°¨ë¡ ì°¨ë¡ë¡ ë¤ìì ììê° íë í¹ì ì¬ë¬ê° ë°ë¼ì¨ë¤ : + <orderedlist> + <listitem> + <simpara> + + ì íì ì¸ <emphasis>í¨ë© ì§ì ì(padding specifier)</emphasis>ë ê²°ê³¼ë¡ ë¬¸ìì´ ì¤ë¥¸ìª½ì ê·¸ ì í´ì§ + í¬ê¸°ë§í¼ í¨ë©ì ê°íëë° ì¬ì©ëë©°, ì´ë 공백 문ì ì¼ ìë ìê³ , <literal>0</literal>(0 문ì)ì¼ ì ë ìë¤. + 기본ì 공백ì¼ë¡ í¨ë©ëë©°, ë¤ë¥¸ í¨ë© 문ìê° ìì ë°ì´í (<literal>'</literal>)ì í¨ê» ìì ë¶ì´ ì§ì ëì´ ì§ + ìë ìë¤. + ìëì ì를 ë³´ë¼. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ <emphasis>ì ë ¬ ì§ì ì(alignment specifier)</emphasis>ë ê²°ê³¼ 문ìì´ì´ ì¼ìª½ ì ë ¬ë ê²ì¸ì§ + ì¤ë¥¸ìª½ ì ë ¬ ë ê²ì¸ì§ë¥¼ ê²°ì íë©°, 기본ì ì¤ë¥¸ìª½ ì ë ¬ì´ë¤; <literal>-</literal>문ìë ì¼ìª½ ì ë ¬ë¡ ë§ë ë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ ì«ì <emphasis>í ì§ì ì(width specifier)</emphasis>ë + (ìµì) ì¼ë§ë ë§ì 문ìë¤ì ì´ ë³íì´ ê²°ê³¼ë¡ ë¼ ê²ì¸ê°ë¥¼ ë§í´ì¤ë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ <emphasis>ì ë°ë ì§ìì(precision specifier)</emphasis>ë + ì¼ë§ë ë§ì ìì§ ì«ìê° ììì ì´íì ìë¡ì íìë ê²ì¸ê°ë¥¼ ì§ì íë¤. + ì´ ìµì ì double íììë§ ì í¨íë¤.(ì«ì를 í¬ë©í íëë° ìì´ì ì ì©í + ë¤ë¥¸ í¨ìë¡ <function>number_format</function>ì´ ìë¤.) + </simpara> + </listitem> + <listitem> + <para> + <emphasis>í ì§ìì(type specifier)</emphasis>ë ì¸ì ë°ì´íê° ì ì©ë íìì ì§ì íë¤. + ê°ë¥í íì ì¼ë¡ë : + <simplelist> + <member> + <literal>%</literal> - 리í°ë´ í¼ì¼í¸ 문ì. ì´ë¤ ì¸ìë íìíì§ ìë¤. + </member> + <member> + <literal>b</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, ìì§ìë¡ ííëë¤. + </member> + <member> + <literal>c</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, ê·¸ ì«ìì ASCIIì½ëì í´ë¹íë 문ìë¡ ííëë¤. + </member> + <member> + <literal>d</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, 10ì§ìë¡ ííëë¤. + </member> + <member> + <literal>f</literal> - ì¸ìë ëë¸íì¼ë¡ ì²ë¦¬ëë©°, ìì«ì ì ê°ì§ë ì¤ì ì«ìë¡ ííëë¤. + </member> + <member> + <literal>o</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, 8ì§ì ííë¡ ííëë¤. + </member> + <member> + <literal>s</literal> - ì¸ìë 문ìì´ë¡ ì²ë¦¬, ííëë¤. + </member> + <member> + <literal>x</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, (ì문ìë¡ íìëë)16ì§ìë¡ ííëë¤. + </member> + <member> + <literal>X</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, (ë문ìë¡ íìëë)16ì§ìë¡ ííëë¤. + </member> + </simplelist> + </para> + </listitem> + </orderedlist> + </para> + <simpara> + <function>printf</function>, <function>sscanf</function>, + <function>fscanf</function>, ê·¸ë¦¬ê³ <function>number_format</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + <refsect1> + <title>ì</title> + <para> + <example> + <title> + <function>Sprintf</function>: 0ì¼ë¡ ì±ìì§ ì ì</title> + <programlisting role="php"> +$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); + </programlisting> + </example> + <example> + <title> + <function>Sprintf</function>: íµíì í¬ë§·</title> + <programlisting role="php"> +$money1 = 68.75; +$money2 = 54.35; +$money = $money1 + $money2; +// echo $moneyë "123.1" ì ì¶ë ¥; +$formatted = sprintf ("%01.2f", $money); +// echo $formatted ë output "123.10"ì ì¶ë ¥ + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.strncasecmp"> + <refnamediv> + <refname>strncasecmp</refname> + <refpurpose> + ëì문ì를 ë¶íì§ ìë 2ì§ì ííì 문ìì´ì ì²ì n ê° ë¬¸ì를 ë¹êµ - + Binary safe case-insensitive string comparison of the first n characters + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strncasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>len</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strcasecmp</function>ì ë¹ì·íë©° ì°¨ì´ë¼ë©´, + ë¹êµì ì¬ì© ë ê°ê°ì 문ìì´ë¡ ë¶í° ë¹êµí 문ìì ì (<parameter>len</parameter>)를 + ì§ì í ì ìë¤ë ê²ì´ë¤. + ë ì¤ íëì 문ìì´ì´ (<parameter>len</parameter>ë³´ë¤ ì§§ë¤ë©´, ì§§ì 문ìì´ì 길ì´ê° + ë 문ìì´ì ë¹êµíë ë° ì¬ì©ëë¤. + </para> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + <function>ereg</function>, <function>strcasecmp</function>, + <function>strcmp</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strcasecmp"> + <refnamediv> + <refname>strcasecmp</refname> + <refpurpose> + ëì문ì를 구ë¶íì§ ìë 2ì§ì ííì 문ìì´ì ë¹êµ (Binary safe case-insensitive string comparison) + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + <example> + <title> + <function>strcasecmp</function> example</title> + <programlisting role="php"> +$var1 = "Hello"; +$var2 = "hello"; +if (!strcasecmp ($var1, $var2)) { + echo '$var1 is equal to $var2 in a case-insensitive string comparison'; +} + </programlisting> + </example> + </para> + <simpara> + <function>ereg</function>, <function>strcmp</function>, + <function>substr</function>, <function>stristr</function>, + <function>strncasecmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strchr"> + <refnamediv> + <refname>strchr</refname> + <refpurpose> + 문ìê° ì²ì ëíë ìì¹ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strchr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strstr</function>ì ë³ì¹ì´ë©°, 모ë ë°©ë©´ìì ëì¼íë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strcmp"> + <refnamediv> + <refname>strcmp</refname> + <refpurpose>2ì§ ííì 문ìì´ì ë¹êµ</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 ë¹êµí¨ì 주ìíë¼. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strncasecmp</function>, + <function>strncmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strcspn"> + <refnamediv> + <refname>strcspn</refname> + <refpurpose> + ë§ì¤í¬ì 매ì¹ëì§ ìë ì´ê¸° ì¸ê·¸ë¨¼í¸ì ê¸¸ì´ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcspn</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str2</parameter> ë´ì ì´ë¤ 문ìë í¬í¨íì§ <emphasis>ìë</emphasis> + <parameter>str1</parameter>ì ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ë°ííë¤. + </simpara> + <simpara> + <function>strspn</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strip-tags"> + <refnamediv> + <refname>strip_tags</refname> + <refpurpose>문ìì´ë¡ ë¶í° HTML íê·¸ì PHP í그를 ìì¤ë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strip_tags</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>allowable_tags</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 모ë HTMLê³¼ PHP í그를 주ì´ì§ 문ìì´ë¡ ë¶í° ì ê±°íë¤. + ìì íì§ ëª»íê±°ë ë³´ê±°ì¤ íê·¸ ê°ì ê²½ì°ì ì´ë¬ë ë¸ë¤. + <function>fgetss</function> í¨ììì ì²ë¼ ê°íê·¸ ì ê±° state 머ì ì ì¬ì©íë¤. + </para> + <para> + ì íì ì¼ë¡ ëë²ì§¸ ì¸ì를 ì¬ì©íì¬ ì ê±°ëì§ ìì í그를 ì§ì í ìë ìë¤. + <note> + <para> + <parameter>Allowable_tags</parameter> ë PHP 3.0.13, PHP4B3 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.stripcslashes"> + <refnamediv> + <refname>stripcslashes</refname> + <refpurpose> + <function>addcslashes</function>ë¡ quote ë 문ìì´ì un-quote íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stripcslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°±ì¬ëì¬ê° ì ê±°ë 문ìì´ì ë°ííë¤. + C íìì <literal>\n</literal>, <literal>\r</literal> ... 8ì§ì ê·¸ë¦¬ê³ 16ì§ì ííë ì¸ìíë¤. + <note> + <simpara> + PHP4b3-dev ìì ì¶ê°ëìë¤. + </simpara> + </note> + </para> + <simpara> + <function>addcslashes</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.stripslashes"> + <refnamediv> + <refname>stripslashes</refname> + <refpurpose> + <function>addslashes</function>ë¡ quote ë 문ìì´ì un-quote íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stripslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°±ì¬ëì¬ê° ì ê±°ë 문ìì´ì ë°ííë¤. + (<literal>\'</literal> ë <literal>'</literal> ë¡ ëë ë±.) + ì´ì¤ ë°±ì¬ëì¬ë íëì ë°±ì¬ëì¬ë¡ ë³íëë¤. + </para> + <simpara> + <function>addslashes</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.stristr"> + <refnamediv> + <refname>stristr</refname> + <refpurpose> + ëì문ì를 구ë³íì§ ìë <function>strstr</function> + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stristr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>needle</parameter>ì ì²ì ë°ì ë¶í° ëë ë ê¹ì§ + 모ë <parameter>haystack</parameter>를 ë°ííë¤. + <parameter>needle</parameter> ê³¼ <parameter>haystack</parameter>ì + ëì문ì를 구ë³íì§ ìê³ ê²ì¬ëë¤. + </para> + <para> + ë§ì½<parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´ false 를 ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë©´, ì´ë ì«ìë¡ ë³íëê³ + 문ìì ììê°ì²ë¼ ì ì©ëë¤. + </para> + <para> + <function>strchr</function>, + <function>strrchr</function>, <function>substr</function>, ê·¸ë¦¬ê³ + <function>ereg</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strlen"> + <refnamediv> + <refname>strlen</refname> + <refpurpose>문ìì´ì 길ì´ë¥¼ 구íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strlen</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>문ìì´ì 길ì´ë¥¼ ë°ííë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strnatcmp"> + <refnamediv> + <refname>strnatcmp</refname> + <refpurpose> + "natural order" ìê³ ë¦¬ì¦ì ì´ì©í 문ìì´ ë¹êµ + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strnatcmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ì¼ë¡ ì¬ëì´ íëê²ê³¼ ê°ì ìí벳과 ì«ì를 ì ë ¬íë ë°©ë²ì ë¹êµ ìê³ ë¦¬ì¦ì ìííë¤. + ì´ ìê³ ë¦¬ì¦ê³¼ ì»´í¨í°ê° ì¬ì©íë ì ë ¬ ìê³ ë¦¬ì¦(<function>strcmp</function>ì ì¬ì©)ê³¼ì ì°¨ì´ê° + ìëì ìì ëì ìë¤.: + <informalexample> + <programlisting> +$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); +echo "Standard string comparison\n"; +usort($arr1,"strcmp"); +print_r($arr1); +echo "\nNatural order string comparison\n"; +usort($arr2,"strnatcmp"); +print_r($arr2); + </programlisting> + </informalexample> + ìì ì½ëë ìëì 결과를 ìì±í ê²ì´ë¤.: + <informalexample> + <programlisting> +기본 문ìì´ ë¹êµ(Standard string comparison) +Array +( + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png +) + +Natural order 문ìì´ ë¹êµ +Array +( + [0] => img1.png + [1] => img2.png + [2] => img10.png + [3] => img12.png +) + </programlisting> + </informalexample> + ë ë§ì ì 보를 ìí´ Martin Pool ì <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> + ì ì°¸ê³ íë¼. + </para> + <simpara> + 문ìì´ ë¹êµ í¨ìì ë¹ì·íê² ì´ í¨ìë, + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 구ë³í¨ì ì ìí´ë¼. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcasecmp</function>, <function>strstr</function>, + <function>natsort</function> ê·¸ë¦¬ê³ <function>natcasesort</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strnatcasecmp"> + <refnamediv> + <refname>strnatcasecmp</refname> + <refpurpose> + ëì문ì êµ¬ë³ ìì´ "natural order" ìê³ ë¦¬ì¦ì¼ë¡ 문ìì´ì ë¹êµíë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strnatcasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ì¼ë¡ ì¬ëì´ íëê²ê³¼ ê°ì ìí벳과 ì«ì를 ì ë ¬íë ë°©ë²ì ë¹êµ ìê³ ë¦¬ì¦ì ìííë¤. + ì´ í¨ìì ìì©ì <function>strnatcmp</function> ì ë¹ì·íë©°, + ëì문ì를 구ë¶íì§ ìëë¤ë ë°ìì ì°¨ì´ê° ëë¤. + ë ë§ì ì 보를 ìí´ Martin Pool ì <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> + ì ì°¸ê³ íë¼. + </para> + <simpara> + 문ìì´ ë¹êµ í¨ìì ë¹ì·íê² ì´ í¨ìë, + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strncmp"> + <refnamediv> + <refname>strncmp</refname> + <refpurpose> + ì²ì n 문ìì binary safe 문ìì´ ë¹êµ + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strncmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>len</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strcmp</function>ë¹ ë¹ì·íë©°, + ë¹êµì ì¬ì© ë ê°ê°ì 문ìì´ë¡ ë¶í° ë¹êµí 문ìì ì (<parameter>len</parameter>)를 + ì§ì í ì ìë¤ë ê²ì ì°¨ì´ê° ìë¤. + ë ì¤ íëì 문ìì´ì´ (<parameter>len</parameter>ë³´ë¤ ì§§ë¤ë©´, ì§§ì 문ìì´ì 길ì´ê° + ë 문ìì´ì ë¹êµíë ë° ì¬ì©ëë¤. + </para> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 구ë¶íë¤ë ê²ì ì ìíë¼. + </simpara> + <simpara> + <function>ereg</function>, <function>strncasecmp</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.str-pad"> + <refnamediv> + <refname>str_pad</refname> + <refpurpose>ë¤ë¥¸ 문ìë¡ í¹ì 길ì´ë§í¼ 문ìì´ì ì±ì´ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_pad</function> + </funcdef> + <paramdef>string <parameter>input</parameter> + </paramdef> + <paramdef>int <parameter>pad_length</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>pad_string</optional> + </parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>pad_type</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>input</parameter>문ìì´ì ì¼ìª½, ì¤ë¥¸ìª½, í¹ì ìë°©í¥ì¼ë¡ í¹ì í í¨ë© 길ì´ë§í¼ ì±ì´ë¤. + ë§ì½ ì íì ì¸ ë§¤ê°ë³ì <parameter>pad_string</parameter>ê° ì ê³µëì§ ìëë¤ë©´, + <parameter>input</parameter>ë 공백ì¼ë¡ ì±ìì§ë©°, ê·¸ë ì§ ìì ê²½ì° + ê·¸ íê³ê¹ì§ <parameter>pad_string</parameter>ë¡ ë¶í°ì 문ì를 ì±ì°ê² ëë¤. + </para> + <para> + ì íì ì¸ ë§¤ê°ë³ì <parameter>pad_type</parameter>ë¡ë + STR_PAD_RIGHT, STR_PAD_LEFT, í¹ì STR_PAD_BOTH ê° ì¬ ì ìë¤. + <parameter>pad_type</parameter>ê° ì§ì ëì§ ìì¼ë©´ STR_PAD_RIGHT ë¡ ì¬ê²¨ì§ë¤. + </para> + <para> + <parameter>pad_length</parameter>ì ê°ì´ ìì ê°ì´ê±°ë ì ë ¥ 문ìì´ì 길ì´ë³´ë¤ ìì ê²½ì° + í¨ë©ì ì¼ì´ëì§ ìëë¤. + </para> + <para> + <example> + <title> + <function>str_pad</function> ì</title> + <programlisting role="php"> +$input = "Alien"; +print str_pad($input, 10); // "Alien " ì´ ìì±ëë¤. +print str_pad($input, 10, "-=", STR_PAD_LEFT); // "-=-=-Alien" ì´ ìì±ëë¤. +print str_pad($input, 10, "_", STR_PAD_BOTH); // "__Alien___" ì´ ìì±ëë¤. + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.strpos"> + <refnamediv> + <refname>strpos</refname> + <refpurpose> + 문ìì´ìì ì²ì ìì¹ë¥¼ ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strpos</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>offset</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>haystack</parameter> 문ìì´ìì ì²ì ëíëë + <parameter>needle</parameter> ì ìì¹ë¥¼ ì«ìë¡ ë°ííë¤. + <function>strrpos</function>ì íë¦¬ê² ì´ í¨ìë + <parameter>needle</parameter> 매ê°ë³ì ë¡ ì ì²´ 문ìì´ì ì¬ì©í ì ìì¼ë©°, + Unlike the + <function>strrpos</function>, this function can take a full + string as the <parameter>needle</parameter> parameter and the + entire string will be used. + </para> + <para> + <parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´ ê±°ì§ì ë°ííë¤. + <note> + <para> + "0ë²ì§¸ ìì¹ìì ë°ê²¬ë 문ì"ì ëí ê°ê³¼ 문ìê° ë°ê²¬ëì§ ììì ê²½ì°ì ë°íëë ê°ì ëí´ + ì¤ì를 ë²í기 ì½ë¤. + ì¬ê¸° ì´ ì°¨ì´ì ì ê°ííë ë°©ë²ì´ ìë¤.: + <informalexample> + <programlisting role="php"> +// PHP 4.0b3 ì´ììì: +$pos = strpos ($mystring, "b"); +if ($pos === false) { // note: === ì ì¬ì© + // ë°ê²¬ëì§ ìì +} + +// PHP 4.0b3 ì´ì ì ë²ì ¼ìì: +$pos = strpos ($mystring, "b"); +if (is_string ($pos) && !$pos) { + // ë°ê²¬ëì§ ìì +} + </programlisting> + </informalexample> + </para> + </note> + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì´ë ì«ìë¡ ë³íëê³ ë¬¸ìì ìì´ ê°(ordinal value)ì¼ë¡ì ì ì©ëë¤. + </para> + <para> + ì íì ì¸ <parameter>offset</parameter> 매ê°ë³ìë + <parameter>haystack</parameter>ì ìë ì´ë¤ 문ìë¶í° 찾기 ììí ì§ë¥¼ ì§ì í ì ìê² í´ ì¤ë¤. + ë°íëë ìì¹ë <parameter>haystack</parameter> ì ììì¼ë¡ íë ìëì ì¸ ìì¹ê° ëë¤. + </para> + <para> + <function>strrpos</function>, + <function>strrchr</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strrchr"> + <refnamediv> + <refname>strrchr</refname> + <refpurpose> + 문ìì´ìì ê°ì¥ ë§ì§ë§ì ì´ì»¤ë°ì¤ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strrchr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>haystack</parameter>ì ì¼ë¶ë¥¼ ë°ííëë°, + ì´ë <parameter>needle</parameter>ì ë§ì§ë§ ì´ì»¤ë°ì¤ìì ììíê³ + <parameter>haystack</parameter>ì ëê¹ì§ ì§íëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + </para> + <para> + <parameter>needle</parameter>ì´ í문ì ì´ìì í¬í¨íê³ ìì¼ë©´, + 첫ë²ì§¸ 문ìê° ì¬ì©ëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì«ìë¡ ë³íëì´ ë¬¸ìì ìì´ê°(ordinal value) ë¡ì ì ì©ëë¤. + <example> + <title> + <function>Strrchr</function> ì</title> + <programlisting role="php"> +// $PATH ììì ë§ì§ë§ ëë í 리를 ì»ëë¤. +$dir = substr (strrchr ($PATH, ":"), 1); + +// ë§ì§ë§ ë´ë¼ì¸ ë¤ìì 문ìì´ì ì»ëë¤. +$text = "Line 1\nLine 2\nLine 3"; +$last = substr (strrchr ($text, 10), 1 ); + </programlisting> + </example> + </para> + <para> + <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.str-repeat"> + <refnamediv> + <refname>str_repeat</refname> + <refpurpose>문ìì´ì ë°ë³µíë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_repeat</function> + </funcdef> + <paramdef>string <parameter>input</parameter> + </paramdef> + <paramdef>int <parameter>multiplier</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>input_str</parameter>ì <parameter>multiplier</parameter>ë² ë°ë³µí´ì ë°ííë¤. + <parameter>multiplier</parameter>ë ë°ëì 0ë³´ë¤ ì»¤ì¼ íë¤. + </para> + <example> + <title> + <function>Str_repeat</function> ì</title> + <programlisting role="php"> +echo str_repeat ("-=", 10); + </programlisting> + </example> + <para> + This will output "-=-=-=-=-=-=-=-=-=-=". + </para> + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.strrev"> + <refnamediv> + <refname>strrev</refname> + <refpurpose>문ìì´ì ë¤ì§ëë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strrev</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ìì¼ë¡ ë <parameter>string</parameter>ì ë°ííë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strrpos"> + <refnamediv> + <refname>strrpos</refname> + <refpurpose> + 문ìì´ ììì 문ìì ë§ì§ë§ ì¶í ìì¹ë¥¼ ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strrpos</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>char <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>haystack</parameter>문ìì´ìì + <parameter>needle</parameter>ì ë§ì§ë§ ì¶í ìì¹ë¥¼ + ì«ìë¡ ë°ííë¤. + ì´ ê²½ì°ì needleì ë¨ì§ ë¨ì¼ 문ìë§ ê°ë¥íë¤ë ê²ì ëª ì¬íë¼. + ë§ì½ 문ìì´ì´ needleë¡ì ì ë¬ëë¤ë©´, ì¤ì§ ê·¸ 문ìì´ì 첫ë²ì§¸ 문ìë§ì´ ì¬ì©ëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + <note> + <para> + ì¼ì´ë기 ì¬ì´ ì¤ì ì¤ì íëë "ìì¹ 0ì´ì 문ìê° ë°ê²¬"ë ê²½ì° ì + "문ìê° ë°ê²¬ëì§ ìì ê²½ì°"ì ëí ë°íê°ì´ë¤. + ì¬ê¸° ì´ ì°¨ì´ë¥¼ ë°ê²¬íë ë°©ë²ì´ ìë¤.: + <informalexample> + <programlisting role="php"> +// PHP 4.0b3 ì´ììì: +$pos = strrpos ($mystring, "b"); +if ($pos === false) { // note: === ì¬ì© + // ë°ê²¬ëì§ ìì +} + +// ë²ì ¼ 4.0b3 ì´íìì: +$pos = strrpos ($mystring, "b"); +if (is_string ($pos) && !$pos) { + // ë°ê²¬ëì§ ìì +} + </programlisting> + </informalexample> + </para> + </note> + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì«ìë¡ ë³íëì´ ë¬¸ìì ìì´ê°(ordinal value) ë¡ì ì ì©ëë¤. + </para> + <para> + <function>strpos</function>, + <function>strrchr</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strspn"> + <refnamediv> + <refname>strspn</refname> + <refpurpose> + ë§ì¤í¬ì 매ì¹ëë ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strspn</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str2</parameter> ë´ì ì´ë¤ 문ìë í¬í¨íë + <parameter>str1</parameter>ì ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ë°ííë¤. + </simpara> + <para> + <informalexample> + <programlisting role="php"> +strspn ("42 is the answer, what is the question ...", "1234567890"); + </programlisting> + <para> + ì ê²°ê³¼ë¡ 2를 ë°ííë¤. + </para> + </informalexample> + </para> + <simpara> + <function>strcspn</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strstr"> + <refnamediv> + <refname>strstr</refname> + <refpurpose>문ìì´ì ì²ì ì´ì»¤ë°ì¤ë¥¼ ì°¾ëë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strstr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>needle</parameter>ì ì²ì ì´ì»¤ë°ì¤ë¶í° ëê¹ì§ì + <parameter>haystack</parameter> ì ë¶ë¥¼ ë°ííë¤. + </para> + <para> + <parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë©´, ì´ë ì«ìë¡ ë³íëê³ + 문ìì ììê°ì²ë¼ ì ì©ëë¤. + </para> + <para> + <note> + <para> + ì´ í¨ìë ëì문ì를 구ë¶íë©°, ëì문ìì 구ë¶ì´ í ì ìì ë + <function>stristr</function>ì ì¬ì©íë¼. + </para> + </note> + </para> + <para> + <example> + <title> + <function>Strstr</function> ì</title> + <programlisting role="php"> +$email = 'sterling@designmultimedia.com'; +$domain = strstr ($email, '@'); +print $domain; // prints @designmultimedia.com + </programlisting> + </example> + </para> + <para> + <function>stristr</function>, + <function>strrchr</function>, <function>substr</function>, ê·¸ë¦¬ê³ + <function>ereg</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.strtok"> + <refnamediv> + <refname>strtok</refname> + <refpurpose>문ìì´ì í í°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtok</function> + </funcdef> + <paramdef>string <parameter>arg1</parameter> + </paramdef> + <paramdef>string <parameter>arg2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>strtok</function>ì 문ìì´ì í í°í íëë° ì¬ì©ëë¤. + ì¦, "This is an example string"ì ê°ì 문ìì´ì´ ìì¼ë©´, + í í°ì¼ë¡ 공백 문ì를 ì¬ì©íì¬ ì´ ë¬¸ìì´ì ê°ê°ì ë¨ì´ë¥¼ í í°í í ì ìë¤. + <example> + <title> + <function>Strtok</function> ì</title> + <programlisting role="php"> +$string = "This is an example string"; +$tok = strtok ($string," "); +while ($tok) { + echo "Word=$tok<br>"; + $tok = strtok (" "); +} + </programlisting> + </example> + </para> + <para> + ì¤ë¡ì§ ì²ì ë¶ë¦¬ìì§ strtok ì´ ë¬¸ìì´ ì¸ì를 ì¬ì©íë¤. + ë¤ì ëì¤ë ê°ê°ì strtok í¸ì¶ì ì¬ì©í¨ì ìì´ í í°ë§ì´ íìíë©° + ì´ë íì¬ì 문ìì´ í¸ëì ì ì§í기 ë문ì´ë¤. + ë¤ì ììíê±°ë ìë¡ì´ 문ìì´ì í í°í íê³ ì íë¤ë©´, + ì´ë¥¼ ì´ê¸°í í기 ìí´ ë¨ìí 문ìì´ ì¸ìì í¨ê» strtok 를 í¸ì¶íë©´ ëë¤. + ë¤ìì í í°ì í í° ë§¤ê°ë³ìì ë£ì ìë ìì¼ë©°, + 문ìì´ì 매ê°ë³ìì ìë 문ì ì¤ ìë¬´ê² íë를 ë§ëë©´, í í°í ëë¤. + </para> + <para> + ìì±ë í í°ì "0" ì´ ë ìë ììì ì ìíë¼. + ì´ë ì¡°ê±´ììì ê±°ì§ì ëíë´ë ê°ì´ê¸°ë íë¤. + </para> + <para> + <function>split</function> ê·¸ë¦¬ê³ + <function>explode</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtolower"> + <refnamediv> + <refname>strtolower</refname> + <refpurpose>문ìì´ì ì문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtolower</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 모ë ìíë²³ì ì문ìë¡ ë³íí 문ìì´ì ë°ííë¤. + </para> + <para> + 'ìíë²³'ì´ë¼ í¨ì íì¬ ë¡ì¼ì¼ì ì í´ ì í´ì§ë¤. ì´ë ì¦ ê¸°ë³¸ì ì¼ë¡ "C" ë¡ì¼ì¼ìì + umlaut-A (© ê°ì 문ìë ë°ëì§ ììì ì미íë¤. + </para> + <example> + <title> + <function>Strtolower</function> ì</title> + <programlisting role="php"> +$str = "Mary Had A Little Lamb and She LOVED It So"; +$str = strtolower($str); +print $str; # mary had a little lamb and she loved it so 를 ì¶ë ¥íë¤. + </programlisting> + </example> + <para> + <function>strtoupper</function> + ê·¸ë¦¬ê³ <function>ucfirst</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtoupper"> + <refnamediv> + <refname>strtoupper</refname> + <refpurpose>문ìì´ì ë문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtoupper</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 모ë ìíë²³ì ë문ìë¡ ë³íí 문ìì´ì ë°ííë¤. + </para> + <para> + 'ìíë²³'ì´ë¼ í¨ì íì¬ ë¡ì¼ì¼ì ì í´ ì í´ì§ë¤. ì´ë ì¦ ê¸°ë³¸ì ì¼ë¡ "C" ë¡ì¼ì¼ìì + umlaut-a(â§ ê°ì 문ìë ë°ëì§ ììì ì미íë¤. + </para> + <example> + <title> + <function>Strtoupper</function> ì</title> + <programlisting role="php"> +$str = "Mary Had A Little Lamb and She LOVED It So"; +$str = strtoupper ($str); +print $str; # MARY HAD A LITTLE LAMB AND SHE LOVED IT SO ì ì¶ë ¥íë¤. + </programlisting> + </example> + <para> + <function>strtolower</function> + ê·¸ë¦¬ê³ <function>ucfirst</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.str-replace"> + <refnamediv> + <refname>str_replace</refname> + <refpurpose> + haystack ì 모ë needleì strë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_replace</function> + </funcdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>haystack</parameter>ì <parameter>needle</parameter>ì + 주ì´ì§ <parameter>str</parameter>ë¡ ë°ê¾¼ë¤. + (This function replaces all occurences of <parameter>needle</parameter> in <parameter>haystack</parameter> + with the given <parameter>str</parameter>.) + ë§ì½ ë³µì¡í ì¹í ë£°ì´ íìíì§ ìë¤ë©´, <function>ereg_replace</function> ëì + ì´ í¨ì를 ì¬ì©íì¬ë ëë¤. + </para> + <para> + <example> + <title> + <function>Str_replace</function> ì</title> + <programlisting role="php"> +$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); + </programlisting> + </example> + </para> + <para> + ì´ í¨ìë binary safe. + </para> + <note> + <para> + <function>Str_replace</function>ë PHP 3.0.6,ìì ì¶ê°ëìì§ë§, + PHP 3.0.8 ì ë²ê·¸ê° ìì ëìë¤. + </para> + </note> + <para> + <function>ereg_replace</function> ê·¸ë¦¬ê³ + <function>strtr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtr"> + <refnamediv> + <refname>strtr</refname> + <refpurpose>í¹ì 문ì를 ë²ìíë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtr</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>from</parameter> + </paramdef> + <paramdef>string <parameter>to</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>str</parameter>ì ëí´ <parameter>from</parameter>ì íí¨ëë ê°ê°ì 문ì를 + <parameter>to</parameter>ì ìë ëìëë 문ìë¡ ë²ìíê³ ê·¸ 결과를 ë°ííë¤. + </para> + <para> + <parameter>from</parameter>ê³¼ <parameter>to</parameter>ê° + ë¤ë¥¸ 길ì´ì¼ ë ë ì¤ ê¸´ 문ìì´ì ëë¨¸ì§ ë¬¸ìë¤ì 무ìëë¤. + <example> + <title> + <function>Strtr</function> ì</title> + <programlisting role="php"> +$addr = strtr($addr, "妶", "aao"); + </programlisting> + </example> + </para> + <para> + <function>strtr</function>ì ë¨ì§ ëê°ì ì¸ì를 ê°ì§ ì ë ìë¤. + ë§ì½ ëê°ì ì¸ìë§ ê°ì§ê³ í¸ì¶ëë¤ë©´ ìë¡ì´ ë°©ìì¼ë¡ ëìíë¤.: + ì´ë <parameter>from</parameter>ì ìì¤ìì ë³í ë + 문ìì´ -> 문ìì´ ìì ê°ë ë°°ì´ì´ì´ì¼ íë¤. + <function>strtr</function>ì íì ì²ìì ê°ì¥ 긴 ë²ì ê°ë¥í 매ì¹ë¥¼ ì°¾ê³ + ê·¸ í ì´ë¯¸ ë²ìë ê²ì ë¤ì ì¹ííë ¤ê³ íì§ ìì ê²ì´ë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$trans = array ("hello" => "hi", "hi" => "hello"); +echo strtr("hi all, I said hello", $trans) . "\n"; + </programlisting> + </informalexample> + This will show: "hello all, I said hi", + </para> + <note> + <simpara> + ë ì¸ì를 ì´ì©íë ë°©ë²ì PHP 4.0 ìì ì¶ê°ëìë¤. + </simpara> + </note> + <para> + <function>ereg_replace</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.substr"> + <refnamediv> + <refname>substr</refname> + <refpurpose>문ìì´ì ì¼ë¶ë¥¼ ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>substr</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter>start</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>length</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Substrì <parameter>start</parameter>ì <parameter>length</parameter> + 매ê°ë³ìì ìí´ ì§ì ë <parameter>string</parameter> 문ìì´ì ì¼ë¶ë¥¼ ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>start</parameter>ììë¼ë©´, ë°íëë 문ìì´ì + 0ë¶í° ììëë <parameter>string</parameter>ì <parameter>start</parameter>ë²ì§¸ ìì¹ìì + ììíë 문ìì´ì´ ë ê²ì´ë¤. + ì를 ë¤ì´ 문ìì´ '<literal>abcdef</literal>'ì´ ìë¤ê³ íì. + <literal>0</literal>ì ìì¹ì ìë 문ìë '<literal>a</literal>'ê° ëê³ , + <literal>2</literal>ì ìì¹ì ìë 문ìë '<literal>c</literal>'ê° ëë ìì´ë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", 1); // "bcdef" ì ë°ííë¤. +$rest = substr ("abcdef", 1, 3); // "bcd" ì ë°ííë¤. + </programlisting> + </informalexample> + </para> + <para> + ë§ì½ <parameter>start</parameter>ê° ììë¼ë©´, + ë°íëë 문ìì´ì <parameter>string</parameter>ì ëììë¶í° + <parameter>start</parameter>ë²ì§¸ ë¶í° ììíë 문ìì´ì´ ëë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", -1); // "f" 를 ë°í +$rest = substr ("abcdef", -2); // "ef" 를 ë°í +$rest = substr ("abcdef", -3, 1); // "d" 를 ë°í + </programlisting> + </informalexample> + </para> + <para> + ë§ì½ <parameter>length</parameter>ì´ ì£¼ì´ì§ê³ ìì ê°ì´ë¼ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ìì ììí´ì + <parameter>length</parameter>ìì ëëë 문ìì´ì´ ë ê²ì´ë¤. + ë§ì½ (ììì´ ë¬¸ìì´ì ëì ì§ë기 ë문ì) 문ìì´ì´ ìì 길ì´ë¥¼ ê°ë ê²°ê³¼ê° ëë¤ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ì 문ì íëê° ë ê²ì´ë¤. + (ìì주: ë¹ë¬¸ìì´ì´ ì¶ë ¥ëë¤.) + </para> + <para> + ë§ì½ <parameter>length</parameter>ì´ ìì ê°ì´ë¼ë©´, + ì¤í¸ë§ì ëìì ë¶í° ììí´ì <parameter>length</parameter>ì + ìì¹ì ìë 문ìê° ë°íëë 문ìì´ì ëì´ ëë 문ìì´ì´ ëë¤. + ë§ì½ 문ìì´ì´ ìì 길ì´ë¥¼ ê°ë ê²°ê³¼ê° ëì¨ë¤ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ì 문ì íëê° ë ê²ì´ë¤. + (ìì주: ë¹ë¬¸ìì´ì´ ì¶ë ¥ëë¤.) + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", 1, -1); // "bcde"를 ë°ííë¤. + </programlisting> + </informalexample> + </para> + <para> + <function>strrchr</function> ê·¸ë¦¬ê³ + <function>ereg</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.substr-count"> + <refnamediv> + <refname>substr_count</refname> + <refpurpose>ë¶ë¶ë¬¸ìì´ì ì를 ì¼ë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>substr_count</function> + </funcdef> + <paramdef>string <parameter>haystrack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>substr_count</function>ì <parameter>haystack</parameter> 문ìì´ì + ìë <parameter>needle</parameter> ë¶ë¶ 문ìì´ì ì를 ë°ííë¤. + </para> + <para> + <example> + <title> + <function>substr_count</function> ì</title> + <programlisting> +print substr_count("This is a test", "is"); // 2를 ì¶ë ¥íë¤. + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.substr-replace"> + <refnamediv> + <refname>substr_replace</refname> + <refpurpose>문ìì´ì ì¼ë¶ë¥¼ ì¹ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>substr_replace</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>string <parameter>replacement</parameter> + </paramdef> + <paramdef>int <parameter>start</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>length</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>substr_replace</function> ë <parameter>string</parameter>ì + <parameter>start</parameter> ì (ì íì ì¼ë¡) <parameter>length</parameter>ë¡ + ì í´ì§ 구ê°ì í´ë¹íë ë¶ë¶ì <parameter>replacement</parameter>ë¡ ì¹ííê³ + ê·¸ 결과를 ë°ííë¤. + </para> + <para> + <parameter>start</parameter>ê° ììë¼ë©´ <parameter>string</parameter>ì + <parameter>start</parameter>ë²ì§¸ ì¹íì´ ì¼ì´ëë¤. + </para> + <para> + <parameter>start</parameter>ê° ììë¼ë©´, <parameter>string</parameter>ì ëìì ë¶í° + <parameter>start</parameter>ë²ì§¸ 문ìê¹ì§ì 문ìì´ì ì¹ííë¤. + </para> + <para> + <parameter>length</parameter>ì´ ììë¼ë©´, ì´ë ì¹í ë + <parameter>string</parameter>ì ì¼ë¶ë¶ì 길ì´ë¥¼ ëíë¸ë¤. + ë§ì½ ììë¼ë©´, <parameter>string</parameter>ì ëìì ë¶í°ì + 문ìì ì를 ëíë¸ë¤. + ë§ì½ 주ì´ì§ì§ ìëë¤ë©´ 기본 ê°ì¼ë¡ strlen(<parameter>string</parameter>) + ì¦, <parameter>string</parameter>ì ëìì ì¹íì´ ëë¨ì ì미íë¤. + </para> + <para> + <example> + <title> + <function>Substr_replace</function> ì</title> + <programlisting role="php"> +<?php +$var = 'ABCDEFGH:/MNRPQR/'; +echo "Original: $var<hr>\n"; + +/* ë¤ì ëê°ì§ ìë $varì 모ë 문ìì´ì 'bob'ì¼ë¡ ì¹ííë¤. */ +echo substr_replace ($var, 'bob', 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; + +/* $varì 첫ë¶ë¶ì 'bob' ì ì½ì íë¤. */ +echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; + +/* ë¤ì ë ìë $var ë´ì 'MNRPQR' ì 'bob'ì¼ë¡ ì¹ííë¤. */ +echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; + +/* $varë¡ ë¶í°'MNRPQR' ì ì§ì´ë¤. */ +echo substr_replace ($var, '', 10, -1) . "<br>\n"; +?> + </programlisting> + </example> + </para> + <para> + <function>str_replace</function> ê·¸ë¦¬ê³ + <function>substr</function>ì ì°¸ê³ íë¼. + </para> + <note> + <simpara> + <function>Substr_replace</function> ë PHP 4.0ìì ì¶ê°ëìë¤. + </simpara> + </note> + </refsect1> + </refentry> + <refentry id="function.trim"> + <refnamediv> + <refname>trim</refname> + <refpurpose> + 문ìì´ì ì²ìê³¼ ëì ìë 공백ì ì ê±°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>trim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 문ìì´ì ì²ìê³¼ ëì ìë 공백문ì를 ì ê±°íê³ ì´ ë¬¸ìì´ì ë°ííë¤. + 공백문ìë¼ í¨ì "\n", "\r", "\t", "\v", "\0", ê·¸ë¦¬ê³ ê³µë°±ì ë§íë¤. + </para> + <para> + <function>chop</function>, <function>rtrim</function> ê·¸ë¦¬ê³ + <function>ltrim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ucfirst"> + <refnamediv> + <refname>ucfirst</refname> + <refpurpose>문ìì´ì ì²ì ê¸ì를 ë문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ucfirst</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë§ì½ 문ìì´ <parameter>str</parameter>ì ì²ì 문ìê° ìíë²³ì´ë¼ë©´, ê·¸ ì²ì ê¸ì를 ë문ìë¡ ë§ë ë¤. + </para> + <para> + 'ìíë²³'ì íì¬ ë¡ì¼ì¼ì ìí´ ì ìëë¤. + ì를ë¤ë©´ ë¡ì¼ì¼ ëí´í¸ê° "C" ë¡ì¼ì¼ë¡ ëì´ ìì ê²½ì° + umlaut-a(â§ ê°ì 문ìë ë°ëì§ ìëë¤. + <example> + <title> + <function>Ucfirst</function> ì</title> + <programlisting role="php"> +$text = 'mary had a little lamb and she loved it so.'; +$text = ucfirst ($text); // $text ë Mary had a little lamb + // and she loved it so. ë¡ ë°ëë¤. + </programlisting> + </example> + </para> + <para> + <function>strtoupper</function> ê·¸ë¦¬ê³ + <function>strtolower</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ucwords"> + <refnamediv> + <refname>ucwords</refname> + <refpurpose> + 문ìì´ì ìë ê° ë¨ì´ì ì²ì ê¸ì를 ë문ìë¡ ë°ê¾¼ë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ucwords</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì ê°ê°ì ë¨ì´ì 첫문ìê° ìíë²³ì´ë¼ë©´ + ê·¸ ê¸ì를 ë문ìë¡ ë°ê¾¼ë¤. + <example> + <title> + <function>ucwords</function> ì</title> + <programlisting role="php"> +$text = "mary had a little lamb and she loved it so."; +$text = ucwords($text); // $text ë : Mary Had A Little + // Lamb And She Loved It So. ì´ ëë¤. + </programlisting> + </example> + <note> + <simpara> + ë¨ì´ì ì ìë ë¤ì íì´í¸ì¤íì´ì¤ê° ì¬ ë ê¹ì§ì 문ì를 ë§íë¤. + (íì´í¸ì¤íì´ì¤ë 공백, í¼í¼ë, ëë¼ì¸, ì¼ë¦¬ì§ë¦¬í´, ìì§í, ìíí ì ì¼ì»«ëë¤.) + </simpara> + </note> + </para> + <para> + <function>strtoupper</function>, + <function>strtolower</function> ê·¸ë¦¬ê³ <function>ucfirst</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.wordwrap"> + <refnamediv> + <refname>wordwrap</refname> + <refpurpose> + ì ì§ë¬¸ì를 ì´ì©í´ 주ì´ì§ ì ë§í¼ì 문ì를 ëííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>wordwrap</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>width</optional> + </parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>break</optional> + </parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>cut</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>문ìì´ì <parameter>width</parameter> + 매ê°ë³ìì ì§ì ë 길ì´ë§í¼(ì íì ) ë©ííë¤. + ì¤ì <parameter>break</parameter> 매ê°ë³ì(ì íì )ì ìí´ ë¶ë¦¬ëë¤. + </para> + <para> + <function>wordwrap</function>ì ìëì ì¼ë¡ 75컬ë¼ìì ë©ì íë©°, ë¸ë ì´í¬ë¡ë '\n'(ë´ë¼ì¸)ì ì¬ì©íë¤. + </para> + <para> + <parameter>cut</parameter>ì´ 1ë¡ ì§ì ëë©´, 문ìì´ì íì ì§ì ë 길ì´ë¡ ë©íëë©°, 주ì´ì§ ëì´ë³´ë¤ ë 긴 ë¨ì´ê° ìë¤ë©´, + ê·¸ ë¨ì´ë ëëì´ ì§ë¤.(ëë²ì§¸ ìì 를 ë³´ë¼) + (See second example). + <note> + <para> + <parameter>cut</parameter> 매ê°ë³ìë PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + <para> + <example> + <title> + <function>wordwrap</function> ì</title> + <programlisting role="php"> +$text = "The quick brown fox jumped over the lazy dog."; +$newtext = wordwrap( $text, 20 ); + +echo "$newtext\n"; + </programlisting> + </example> + </para> + <para> + ì´ ìë ë¤ìì ì¶ë ¥íë¤.: + </para> + <para> + <informalexample> + <programlisting> +The quick brown fox +jumped over the lazy dog. + </programlisting> + </informalexample> + </para> + <para> + <example> + <title> + <function>wordwrap</function> ì</title> + <programlisting role="php"> +$text = "A very long woooooooooooord."; +$newtext = wordwrap( $text, 8, "\n", 1); + +echo "$newtext\n"; + </programlisting> + </example> + </para> + <para> + ì´ ìë ë¤ìì ì¶ë ¥íë¤.: + </para> + <para> + <informalexample> + <programlisting> +A very +long +wooooooo +ooooord. + </programlisting> + </informalexample> + </para> + <para> + <function>nl2br</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +-->
Index: phpdoc/kr/functions/strings.xml diff -u phpdoc/kr/functions/strings.xml:1.2 phpdoc/kr/functions/strings.xml:1.3 --- phpdoc/kr/functions/strings.xml:1.2 Fri Jan 12 06:16:40 2001 +++ phpdoc/kr/functions/strings.xml Mon Jan 29 20:17:20 2001 @@ -1,3253 +1,3254 @@ - <reference id="ref.strings"> - <title>String functions</title> - <titleabbrev>Strings</titleabbrev> - - <partintro> - <simpara> - These functions all manipulate strings in various ways. Some more - specialized sections can be found in the regular expression and - URL handling sections. - </simpara> - - <para> - For information on how strings behave, especially with regard to - usage of single quotes, double quotes, and escape sequences, see - the <link linkend="language.types.string">Strings</link> entry in - the <link linkend="language.types">Types</link> section of the - manual. - </para> - </partintro> - - <refentry id="function.addcslashes"> - <refnamediv> - <refname>AddCSlashes</refname> - <refpurpose>Quote string with slashes in a C style</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>addcslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>charlist</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes before characters that are - listed in <parameter>charlist</parameter> parameter. It escapes - <literal>\n</literal>, <literal>\r</literal> etc. in C-like - style, characters with ASCII code lower than 32 and higher than - 126 are converted to octal representation. Be carefull when - escaping alphanumeric characters. You can specify a range in - <parameter>charlist</parameter> like "\0..\37", which would - escape all characters with ASCII code between 0 and 31. - <example> - <title><function>Addcslashes</function> example</title> - <programlisting role="php"> -$escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); - </programlisting> - </example> - <note> - <simpara> - Added in PHP4b3-dev.</simpara> - </note> - </para> - <para> - See also <function>stripcslashes</function>, - <function>stripslashes</function>, - <function>htmlspecialchars</function>, - <function>htmlspecialchars</function>, and - <function>quotemeta</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.addslashes"> - <refnamediv> - <refname>AddSlashes</refname> - <refpurpose>Quote string with slashes</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>addslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes before characters that need - to be quoted in database queries etc. These characters are - single quote (<literal>'</literal>), double quote - (<literal>"</literal>), backslash (<literal>\</literal>) - and NUL (the null byte). - </para> - <para> - See also <function>stripslashes</function>, - <function>htmlspecialchars</function>, and - <function>quotemeta</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.bin2hex"> - <refnamediv> - <refname>bin2hex</refname> - <refpurpose> - Convert binary data into hexadecimal representation - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>bin2hex</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an ASCII string containing the hexadecimal representation - of <parameter>str</parameter>. The conversion is done byte-wise - with the high-nibble first. - </para> - </refsect1> - </refentry> - - <refentry id="function.chop"> - <refnamediv> - <refname>Chop</refname> - <refpurpose>Remove trailing whitespace</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chop</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the argument string without trailing whitespace, - including newlines. - <example> - <title><function>Chop</function> example</title> - <programlisting role="php"> -$trimmed = chop ($line); - </programlisting> - </example> - </para> - <note> - <para> - <function>chop</function> is different than the Perl - <parameter>chop()</parameter> function, which removes the last - character in the string. - </para> - </note> - <para> - See also <function>trim</function>, <function>ltrim</function>, - <function>rtrim</function>, and <function>chop</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.chr"> - <refnamediv> - <refname>Chr</refname> - <refpurpose>Return a specific character</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chr</function></funcdef> - <paramdef>int <parameter>ascii</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a one-character string containing the character specified - by <parameter>ascii</parameter>. - <example> - <title><function>Chr</function> example</title> - <programlisting role="php"> -$str .= chr (27); /* add an escape character at the end of $str */ - -/* Often this is more useful */ - -$str = sprintf ("The string ends in escape: %c", 27); - </programlisting> - </example> - This function complements <function>ord</function>. See also - <function>sprintf</function> with a format string of - <literal>%c</literal>. - </para> - </refsect1> - </refentry> - - <refentry id="function.chunk-split"> - <refnamediv> - <refname>chunk_split</refname> - <refpurpose>Split a string into smaller chunks</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>chunk_split</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int - <parameter><optional>chunklen</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>end</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Can be used to split a string into smaller chunks which is useful - for e.g. converting <link - linkend="function.base64-encode">base64_encode</link> output to - match RFC 2045 semantics. It inserts every - <parameter>chunklen</parameter> (defaults to 76) chars the string - <parameter>end</parameter> (defaults to "\r\n"). It returns the - new string leaving the original string untouched. - <example> - <title><function>Chunk_split</function> example</title> - <programlisting role="php"> -# format $data using RFC 2045 semantics - -$new_string = chunk_split (base64_encode($data)); - </programlisting> - </example> - This function is significantly faster than - <function>ereg_replace</function>. - <note> - <para> - This function was added in 3.0.6. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.convert-cyr-string"> - <refnamediv> - <refname>convert_cyr_string</refname> - <refpurpose> - Convert from one Cyrillic character set to another - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>convert_cyr_string</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>from</parameter></paramdef> - <paramdef>string <parameter>to</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function converts the given string from one Cyrillic - character set to another. The <parameter>from</parameter> and - <parameter>to</parameter> arguments are single characters that - represent the source and target Cyrillic character sets. The - supported types are: - <itemizedlist> - <listitem> - <simpara> - k - koi8-r - </simpara> - </listitem> - <listitem> - <simpara> - w - windows-1251 - </simpara> - </listitem> - <listitem> - <simpara> - i - iso8859-5 - </simpara> - </listitem> - <listitem> - <simpara> - a - x-cp866 - </simpara> - </listitem> - <listitem> - <simpara> - d - x-cp866 - </simpara> - </listitem> - <listitem> - <simpara> - m - x-mac-cyrillic - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> - - <refentry id="function.count-chars"> - <refnamediv> - <refname>count_chars</refname> - <refpurpose> - Return information abouts characters used in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>count_chars</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef> - <parameter> - <optional>mode</optional> - </parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Counts the number of occurances of every byte-value (0..255) in - <parameter>string</parameter> and returns it in various ways. - The optional parameter <parameter>Mode</parameter> default to - 0. Depending on <parameter>mode</parameter> - <function>count_chars</function> returns one of the following: - <itemizedlist> - <listitem> - <simpara> - 0 - an array with the byte-value as key and the freqency of - every byte as value. - </simpara> - </listitem> - <listitem> - <simpara> - 1 - same as 0 but only byte-values with a frequency greater - than zero are listed. - </simpara> - </listitem> - <listitem> - <simpara> - 2 - same as 0 but only byte-values with a frequency equal to - zero are listed. - </simpara> - </listitem> - <listitem> - <simpara> - 3 - a string containing all used byte-values is returned. - </simpara> - </listitem> - <listitem> - <simpara> - 4 - a string containing all not used byte-values is returned. - </simpara> - </listitem> - </itemizedlist> - </para> - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </refsect1> - </refentry> - - <refentry id="function.crc32"> - <refnamediv> - <refname>crc32</refname> - <refpurpose>Calculates the crc32 polynomial of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>crc32</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Generates the cyclic redundancy checksum polynomial of 32-bit lengths of - the <parameter>str</parameter>. This is usually used to validate the - integrity of data being trasmited. - </para> - <para> - See also: <function>md5</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.crypt"> - <refnamediv> - <refname>crypt</refname> - <refpurpose>DES-encrypt a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>crypt</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string - <parameter><optional>salt</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>crypt</function> will encrypt a string using the - standard Unix <abbrev>DES</abbrev> encryption method. Arguments - are a string to be encrypted and an optional two-character salt - string to base the encryption on. See the Unix man page for your - crypt function for more information. - </para> - <simpara> - If the salt argument is not provided, one will be randomly - generated by PHP. - </simpara> - <simpara> - Some operating systems support more than one type of encryption. - In fact, sometimes the standard DES encryption is replaced by an - MD5 based encryption algorithm. The encryption type is triggered - by the salt argument. At install time, PHP determines the - capabilities of the crypt function and will accept salts for - other encryption types. If no salt is provided, PHP will - auto-generate a standard 2-character DES salt by default, unless - the default encryption type on the system is MD5, in which case a - random MD5-compatible salt is generated. PHP sets a constant - named CRYPT_SALT_LENGTH which tells you whether a regular - 2-character salt applies to your system or the longer 12-char MD5 - salt is applicable. - </simpara> - <simpara> - If you are using the supplied salt, you should be aware that the - salt is generated once. If you are calling this function - recursively, this may impact both appearance and, to a certain - extent, security. - </simpara> - <simpara> - The standard DES encryption <function>crypt</function> contains - the salt as the first two characters of the output. - </simpara> - <simpara> - On systems where the crypt() function supports multiple - encryption types, the following constants are set to 0 or 1 - depending on whether the given type is available: - </simpara> - <itemizedlist> - <listitem> - <simpara> - CRYPT_STD_DES - Standard DES encryption with a 2-char SALT - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_EXT_DES - Extended DES encryption with a 9-char SALT - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_MD5 - MD5 encryption with a 12-char SALT starting with - $1$ - </simpara> - </listitem> - <listitem> - <simpara> - CRYPT_BLOWFISH - Extended DES encryption with a 16-char SALT - starting with $2$ - </simpara> - </listitem> - </itemizedlist> - <simpara> - There is no decrypt function, since <function>crypt</function> - uses a one-way algorithm. - </simpara> - <simpara> - See also: <function>md5</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.echo"> - <refnamediv> - <refname>echo</refname> - <refpurpose>Output one or more strings</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>echo</function></funcdef> - <paramdef>string <parameter>arg1</parameter></paramdef> - <paramdef>string - <parameter><optional>argn</optional>...</parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Outputs all parameters. - </simpara> - <para> - <function>Echo</function> is not actually a function (it is a - language construct) so you are not required to use parantheses - with it. - <example> - <title><function>Echo</function> example</title> - <programlisting role="php"> -echo "Hello World"; - -echo "This spans -multiple lines. The newlines will be -output as well"; - -echo "This spans\nmultiple lines. The newlines will be\noutput as well."; - </programlisting> - </example> - </para> - <note> - <para> - In fact, if you want to pass more than one parameter to echo, - you must not enclose the parameters within parentheses. - </para> - </note> - <simpara> - See also: - <function>print</function>, - <function>printf</function>, and - <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.explode"> - <refnamediv> - <refname>explode</refname> - <refpurpose>Split a string by string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>explode</function></funcdef> - <paramdef>string <parameter>separator</parameter></paramdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int - <parameter><optional>limit</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns an array of strings, each of which is a substring of - <parameter>string</parameter> formed by splitting it on boundaries formed - by the string <parameter>delim</parameter>. - If <parameter>limit</parameter> is set, the returned array will contaion - a maximum of <parameter>limit</parameter> elements with the last element - containing the whole rest of <parameter>string</parameter>. - </para> - <note> - <para> - The <parameter>limit</parameter> parameter was added in PHP 4.0.1 - </para> - </note> - <para> - <example> - <title><function>Explode</function> example</title> - <programlisting role="php"> -$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; -$pieces = explode (" ", $pizza); - </programlisting> - </example> - </para> - <note> - <para> - Although <function>implode</function> can for historical reasons - accept its parameters in either order, - <function>explode</function> cannot. You must ensure that the - <parameter>separator</parameter> argument comes before the - <parameter>string</parameter> argument. - </para> - </note> - <para> - See also <function>split</function> and - <function>implode</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.get-html-translation-table"> - <refnamediv> - <refname>get_html_translation_table</refname> - <refpurpose> - Returns the translation table used by - <function>htmlspecialchars</function> and - <function>htmlentities</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string - <function>get_html_translation_table</function> - </funcdef> - <paramdef>int <parameter>table</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>get_html_translation_table</function> will return the - translation table that is used internally for - <function>htmlspecialchars</function> and - <function>htmlentities</function>. There are two new defines - (<parameter>HTML_ENTITIES</parameter>, - <parameter>HTML_SPECIALCHARS</parameter>) that allow you to - specify the table you want. And as in the - <function>htmlspecialchars</function> and - <function>htmlentities</function> 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 <function>htmlspecialchars</function>. - <example> - <title>Translation Table Example</title> - <programlisting role="php"> -$trans = get_html_translation_table (HTML_ENTITIES); -$str = "Hallo & <Frau> & Krämer"; -$encoded = strtr ($str, $trans); - </programlisting> - </example> - The <literal>$encoded</literal> variable will now contain: "Hallo - &<sgmltag>amp</sgmltag>; - &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; - &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". - </para> - <para> - The cool thing is using <function>array_flip</function> to change - the direction of the translation. - <informalexample> - <programlisting role="php"> -$trans = array_flip ($trans); -$original = strtr ($str, $trans); - </programlisting> - </informalexample> - The content of <literal>$original</literal> would be: "Hallo & - <Frau> & Krämer". - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </para> - <para> - See also: <function>htmlspecialchars</function>, - <function>htmlentities</function>, <function>strtr</function>, - and <function>array_flip</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.get-meta-tags"> - <refnamediv> - <refname>get_meta_tags</refname> - <refpurpose> - Extracts all meta tag content attributes from a file and returns - an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>array <function>get_meta_tags</function></funcdef> - <paramdef>string <parameter>filename</parameter></paramdef> - <paramdef>int - <parameter><optional>use_include_path</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Opens <parameter>filename</parameter> and parses it line by line - for <meta> tags of the form - <example> - <title>Meta Tags Example</title> - <programlisting role="html"> -<meta name="author" content="name"> -<meta name="tags" content="php3 documentation"> -</head> <!-- parsing stops here --> - </programlisting> - </example> - (pay attention to line endings - PHP uses a native function to - parse the input, so a Mac file won't work on Unix). - </para> - <para> - The value of the name property becomes the key, the value of the - content property becomes the value of the returned array, so you - can easily use standard array functions to traverse it or access - single values. Special characters in the value of the name - property are substituted with '_', the rest is converted to lower - case. - </para> - <para> - Setting <parameter>use_include_path</parameter> to 1 will result - in PHP trying to open the file along the standard include path. - </para> - </refsect1> - </refentry> - - <refentry id="function.hebrev"> - <refnamediv> - <refname>hebrev</refname> - <refpurpose> - Convert logical Hebrew text to visual text - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>hebrev</function></funcdef> - <paramdef>string <parameter>hebrew_text</parameter></paramdef> - <paramdef>int - <parameter><optional>max_chars_per_line</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - The optional parameter <parameter>max_chars_per_line</parameter> - indicates maximum number of characters per line will be output. The - function tries to avoid breaking words. - </para> - <para> - See also <function>hebrevc</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.hebrevc"> - <refnamediv> - <refname>hebrevc</refname> - <refpurpose> - Convert logical Hebrew text to visual text with newline conversion - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>hebrevc</function></funcdef> - <paramdef>string <parameter>hebrew_text</parameter></paramdef> - <paramdef>int - <parameter><optional>max_chars_per_line</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>hebrev</function> with the - difference that it converts newlines (\n) to "<br>\n". - The optional parameter <parameter>max_chars_per_line</parameter> - indicates maximum number of characters per line will be output. The - function tries to avoid breaking words. - </para> - <para> - See also <function>hebrev</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.htmlentities"> - <refnamediv> - <refname>htmlentities</refname> - <refpurpose> - Convert all applicable characters to HTML entities - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>htmlentities</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is identical to - <function>htmlspecialchars</function> in all ways, except that - all characters which have HTML character entity equivalents are - translated into these entities. Like - <function>htmlspecialchars</function>, it takes an optional - second argument which indicates what should be done with single - and double quotes. <constant>ENT_COMPAT</constant> (the default) - will only convert double-quotes and leave single-quotes alone. - <constant>ENT_QUOTES</constant> will convert both double and - single quotes, and <constant>ENT_NOQUOTES</constant> will leave - both double and single quotes unconverted. - </para> - <para> - At present, the ISO-8859-1 character set is used. Note that the optional - second argument was added in PHP 3.0.17 and PHP 4.0.3. - </para> - <para> - See also <function>htmlspecialchars</function> and - <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.htmlspecialchars"> - <refnamediv> - <refname>htmlspecialchars</refname> - <refpurpose> - Convert special characters to HTML entities - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>htmlspecialchars</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Certain characters have special significance in HTML, and should - be represented by HTML entities if they are to preserve their - meanings. This function returns a string with some of these - conversions made; the translations made are those most - useful for everyday web programming. If you require all HTML - character entities to be translated, use - <function>htmlentities</function> instead. - </para> - <simpara> - This function is useful in preventing user-supplied text from - containing HTML markup, such as in a message board or guest book - application. The optional second argument, quote_style, tells the - function what to do with single and double quote characters. The - default mode, ENT_COMPAT, is the backwards compatible mode which only - translates the double-quote character and leaves the single-quote - untranslated. If ENT_QUOTES is set, both single and double quotes - are translated and if ENT_NOQUOTES is set neither single nor double quotes - are translated. - </simpara> - <para> - The translations performed are: - <itemizedlist> - <listitem> - <simpara> - '&' (ampersand) becomes '&amp;' - </simpara> - </listitem> - <listitem> - <simpara> - '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set. - </simpara> - </listitem> - <listitem> - <simpara> - ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set. - </simpara> - </listitem> - <listitem> - <simpara> - '<' (less than) becomes '&lt;' - </simpara> - </listitem> - <listitem> - <simpara> - '>' (greater than) becomes '&gt;' - </simpara> - </listitem> - </itemizedlist> - <example> - <title><function>htmlspecialchars</function> example</title> - <programlisting role="php"> -$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); - </programlisting> - </example> - </para> - <para> - Note that this function does not translate anything beyond what - is listed above. For full entity translation, see - <function>htmlentities</function>. Also note that the optional second - argument was added in PHP 3.0.17 and PHP 4.0.3. - </para> - <para> - See also <function>htmlentities</function> and - <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.implode"> - <refnamediv> - <refname>implode</refname> - <refpurpose>Join array elements with a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>implode</function></funcdef> - <paramdef>string <parameter>glue</parameter></paramdef> - <paramdef>array <parameter>pieces</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string containing a string representation of all the - array elements in the same order, with the glue string between - each element. - <example> - <title><function>Implode</function> example</title> - <programlisting role="php"> -$colon_separated = implode (":", $array); - </programlisting> - </example> - </para> - <note> - <para> - <function>implode</function> can, for historical reasons, accept - its parameters in either order. For consistency with - <function>explode</function>, however, it may be less confusing - to use the documented order of arguments. - </para> - </note> - <simpara> - See also <function>explode</function>, <function>join</function>, - and <function>split</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.join"> - <refnamediv> - <refname>join</refname> - <refpurpose>Join array elements with a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>join</function></funcdef> - <paramdef>string <parameter>glue</parameter></paramdef> - <paramdef>array <parameter>pieces</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>join</function> is an alias to - <function>implode</function>, and is identical in every way. - </simpara> - <simpara> - See also <function>explode</function>, <function>implode</function>, - and <function>split</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.levenshtein"> - <refnamediv> - <refname>levenshtein</refname> - <refpurpose> - Calculate Levenshtein distance between two strings - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>cost_ins</parameter></paramdef> - <paramdef>int <parameter>cost_rep</parameter></paramdef> - <paramdef>int <parameter>cost_del</parameter></paramdef> - </funcprototype> - <funcprototype> - <funcdef>int <function>levenshtein</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>function <parameter>cost</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns the Levenshtein-Distance between the - two argument strings or -1, if one of the argument strings - is longer than the limit of 255 characters (255 should be - more than enough for name or dictionary comparison, and - nobody serious would be doing genetic analysis with PHP). - </para> - <para> - The Levenshtein distance is defined as the minimal number of - characters you have to replace, insert or delete to transform - <parameter>str1</parameter> into <parameter>str2</parameter>. - The complexity of the algorithm is <literal>O(m*n)</literal>, - where <literal>n</literal> and <literal>m</literal> are the - length of <parameter>str1</parameter> and - <parameter>str2</parameter> (rather good when compared to - <function>similar_text</function>, which is O(max(n,m)**3), - but still expensive). - </para> - <para> - In its simpelest form the function will take only the two - strings as parameter and will calculate just the number of - insert, replace and delete operations needed to transform - <parameter>str1</parameter> into <parameter>str2</parameter>. - </para> - <para> - A second variant will take three additional parameters that - define the cost of insert, replace and delete operations. - This is more general and adaptive than variant one, but not - as efficient. - </para> - <para> - The third variant (which is not implemented yet) will be - the most general and adaptive, but also the slowest alternative. - It will call a user-supplied function that will determine the - cost for every possible operation. - </para> - <para> - The user-supplied function will be called with the following - arguments: - <itemizedlist> - <listitem> - <simpara> - operation to apply: 'I', 'R' or 'D' - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 2 - </simpara> - </listitem> - </itemizedlist> - The user-supplied function has to return a positive integer - describing the cost for this particular operation, but it - may decide to use only some of the supplied arguments. - </para> - <para> - The user-supplied function approach offers the possibility to - take into account the relevance of and/or difference between - certain symbols (characters) or even the context those symbols - appear in to determine the cost of insert, replace and delete - operations, but at the cost of loosing all optimizations done - regarding cpu register utilization and cache misses that have - been worked into the other two variants. - </para> - <para> - See also <function>soundex</function>, - <function>similar_text</function> - and <function>metaphone</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ltrim"> - <refnamediv> - <refname>ltrim</refname> - <refpurpose> - Strip whitespace from the beginning of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ltrim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function strips whitespace from the start of a string and - returns the stripped string. The whitespace - characters it currently strips are: "\n", "\r", "\t", "\v", "\0", - and a plain space. - </para> - <para> - See also <function>chop</function>, <function>rtrim</function>, and - <function>trim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.md5"> - <refnamediv> - <refname>md5</refname> - <refpurpose>Calculate the md5 hash of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>md5</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the MD5 hash of <parameter>str</parameter> using the - <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. - MD5 Message-Digest Algorithm</ulink>. - </para> - <para> - See also: <function>crc32</function> - </para> - </refsect1> - </refentry> - - <refentry id="function.metaphone"> - <refnamediv> - <refname>Metaphone</refname> - <refpurpose>Calculate the metaphone key of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>metaphone</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the metaphone key of <parameter>str</parameter>. - </para> - <para> - Similar to <function>soundex</function> metaphone creates the - same key for similar sounding words. It's more accurate than - <function>soundex</function> as it knows the basic rules of - English pronunciation. The metaphone generated keys are of - variable length. - </para> - <para> - Metaphone was developed by Lawrence Philips - <lphilips@verity.com>. It is described in ["Practical - Algorithms for Programmers", Binstock & Rex, Addison Wesley, - 1995]. - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.nl2br"> - <refnamediv> - <refname>nl2br</refname> - <refpurpose>Converts newlines to HTML line breaks</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>nl2br</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with '<BR>' inserted - before all newlines. - </para> - <para> - See also <function>htmlspecialchars</function>, - <function>htmlentities</function> and - <function>wordwrap</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ord"> - <refnamediv> - <refname>Ord</refname> - <refpurpose>Return ASCII value of character</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>ord</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the ASCII value of the first character of - <parameter>string</parameter>. This function complements - <function>chr</function>. - <example> - <title><function>Ord</function> example</title> - <programlisting role="php"> -if (ord ($str) == 10) { - echo "The first character of \$str is a line feed.\n"; -} - </programlisting> - </example> - </para> - <simpara> - See also <function>chr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.parse-str"> - <refnamediv> - <refname>parse_str</refname> - <refpurpose>Parses the string into variables</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>void <function>parse_str</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>array <parameter><optional>arr</optional></parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Parses <parameter>str</parameter> as if it were the query string - passed via an URL and sets variables in the current scope. If - the second parameter <parameter>arr</parameter> is present, - variables are stored in this variable as an array elements instead. - </para> - <para> - <example> - <title>Using <function>parse_str</function></title> - <programlisting role="php"> -$str = "first=value&second[]=this+works&second[]=another"; -parse_str($str); -echo $first; /* prints "value" */ -echo $second[0]; /* prints "this works" */ -echo $second[1]; /* prints "another" */ - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.print"> - <refnamediv> - <refname>print</refname> - <refpurpose>Output a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>print</function></funcdef> - <paramdef>string <parameter>arg</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Outputs <parameter>arg</parameter>. - </simpara> - <simpara> - See also: <function>echo</function>, <function>printf</function>, - and <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.printf"> - <refnamediv> - <refname>printf</refname> - <refpurpose>Output a formatted string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>printf</function></funcdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>mixed - <parameter><optional>args</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Produces output according to <parameter>format</parameter>, which - is described in the documentation for <function>sprintf</function>. - </simpara> - <simpara> - See also: <function>print</function>, <function>sprintf</function>, - <function>sscanf</function>, <function>fscanf</function>, - and <function>flush</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.quoted-printable-decode"> - <refnamediv> - <refname>quoted_printable_decode</refname> - <refpurpose> - Convert a quoted-printable string to an 8 bit string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string - <function>quoted_printable_decode</function> - </funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - This function returns an 8-bit binary string corresponding to the - decoded quoted printable string. This function is similar to - <function>imap_qprint</function>, except this one does not - require the IMAP module to work. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.quotemeta"> - <refnamediv> - <refname>quotemeta</refname> - <refpurpose>Quote meta characters</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>quotemeta</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a version of str with a backslash character - (<literal>\</literal>) before every character that is among - these: <screen>. \\ + * ? [ ^ ] ( $ )</screen> - </para> - <simpara> - See also <function>addslashes</function>, - <function>htmlentities</function>, - <function>htmlspecialchars</function>, - <function>nl2br</function>, and - <function>stripslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.rtrim"> - <refnamediv> - <refname>rtrim</refname> - <refpurpose>Remove trailing whitespace.</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcdef>string <function>rtrim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcsynopsis> - <para> - Returns the argument string without trailing whitespace, - including newlines. This is an alias for <function>chop</function>. - <example> - <title><function>rtrim</function> example</title> - <programlisting role="php"> -$trimmed = rtrim ($line); - </programlisting> - </example> - </para> - <para> - See also <function>trim</function>, <function>ltrim</function>, and - <function>rtrim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.sscanf"> - <refnamediv> - <refname>sscanf</refname> - <refpurpose>Parses input from a string according to a format</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>sscanf</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>string - <parameter><optional>var1</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - The function <function>sscanf</function> is the input analog of - <function>printf</function>. <function>Sscanf</function> reads from - the string <parameter>str</parameter> and interprets it according to - the specified <parameter>format</parameter>. If only two parameters were - passed to this function, the values parsed will be returned as an array. - <example> - <title><function>Sscanf</function> Example</title> - <programlisting role="php"> -// getting the serial number -$serial = sscanf("SN/2350001","SN/%d"); -// and the date of manufacturing -$mandate = "January 01 2000"; -list($month, $day, $year) = sscanf($mandate,"%s %d %d"); -echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; - </programlisting> - </example> - If optional parameters are passed, the function will return the number of - assigned values. The optional parameters must be passed by reference. - <example> - <title><function>Sscanf</function> - using optional parameters</title> - <programlisting role="php"> -// get author info and generate DocBook entry -$auth = "24\tLewis Carroll"; -$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); -echo "<author id='$id'> - <firstname>$first</firstname> - <surname>$last</surname> -</author>\n"; - </programlisting> - </example> - </para> - <para> - See also: <function>fscanf</function>, <function>printf</function>, - and <function>sprintf</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.setlocale"> - <refnamediv> - <refname>setlocale</refname> - <refpurpose>Set locale information</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>setlocale</function></funcdef> - <paramdef>string <parameter>category</parameter></paramdef> - <paramdef>string <parameter>locale</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <parameter>Category</parameter> is a string specifying the - category of the functions affected by the locale setting: - <itemizedlist> - <listitem> - <simpara> - LC_ALL for all of the below - </simpara> - </listitem> - <listitem> - <simpara> - LC_COLLATE for string comparison - not currently implemented in PHP - </simpara> - </listitem> - <listitem> - <simpara> - LC_CTYPE for character classification and conversion, for - example <function>strtoupper</function> - </simpara> - </listitem> - <listitem> - <simpara> - LC_MONETARY for localeconv() - not currently implemented in - PHP - </simpara> - </listitem> - <listitem> - <simpara> - LC_NUMERIC for decimal separator - </simpara> - </listitem> - <listitem> - <simpara> - LC_TIME for date and time formatting with - <function>strftime</function> - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - If <parameter>locale</parameter> is the empty string - <literal>""</literal>, the locale names will be set from the - values of environment variables with the same names as the above - categories, or from "LANG". - </para> - <para> - If locale is zero or <literal>"0"</literal>, the locale setting - is not affected, only the current setting is returned. - </para> - <para> - Setlocale returns the new current locale, or false if the locale - functionality is not implemented in the plattform, the specified - locale does not exist or the category name is invalid. - An invalid category name also causes a warning message. - </para> - </refsect1> - </refentry> - - <refentry id="function.similar-text"> - <refnamediv> - <refname>similar_text</refname> - <refpurpose> - Calculate the similarity between two strings - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>similar_text</function></funcdef> - <paramdef>string <parameter>first</parameter></paramdef> - <paramdef>string <parameter>second</parameter></paramdef> - <paramdef>double - <parameter><optional>percent</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - 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. - </para> - <para> - By passing a reference as third argument, - <function>similar_text</function> will calculate the similarity - in percent for you. It returns the number of matching chars in - both strings. - </para> - </refsect1> - </refentry> - - <refentry id="function.soundex"> - <refnamediv> - <refname>soundex</refname> - <refpurpose>Calculate the soundex key of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>soundex</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Calculates the soundex key of <parameter>str</parameter>. - </para> - <para> - 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. - </para> - <para> - 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. - </para> - <para> - <example> - <title>Soundex Examples</title> - <programlisting role="php"> -soundex ("Euler") == soundex ("Ellery") == 'E460'; -soundex ("Gauss") == soundex ("Ghosh") == 'G200'; -soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; -soundex ("Knuth") == soundex ("Kant") == 'K530'; -soundex ("Lloyd") == soundex ("Ladd") == 'L300'; -soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.sprintf"> - <refnamediv> - <refname>sprintf</refname> - <refpurpose>Return a formatted string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>sprintf</function></funcdef> - <paramdef>string <parameter>format</parameter></paramdef> - <paramdef>mixed - <parameter><optional>args</optional></parameter>... - </paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns a string produced according to the formatting string - <parameter>format</parameter>. - </simpara> - <simpara> - The format string is composed of zero or more directives: - ordinary characters (excluding <literal>%</literal>) that are - copied directly to the result, and <emphasis>conversion - specifications</emphasis>, each of which results in fetching its - own parameter. This applies to both <function>sprintf</function> - and <function>printf</function>. - </simpara> - <para> - Each conversion specification consists of a percent sign - (<literal>%</literal>), followed by one or more of these - elements, in order: - <orderedlist> - <listitem> - <simpara> - An optional <emphasis>padding specifier</emphasis> that says - what character will be used for padding the results to the - right string size. This may be a space character or a - <literal>0</literal> (zero character). The default is to pad - with spaces. An alternate padding character can be specified - by prefixing it with a single quote (<literal>'</literal>). - See the examples below. - </simpara> - </listitem> - <listitem> - <simpara> - An optional <emphasis>alignment specifier</emphasis> that says - if the result should be left-justified or right-justified. - The default is right-justified; a <literal>-</literal> - character here will make it left-justified. - </simpara> - </listitem> - <listitem> - <simpara> - An optional number, a <emphasis>width specifier</emphasis> - that says how many characters (minimum) this conversion should - result in. - </simpara> - </listitem> - <listitem> - <simpara> - An optional <emphasis>precision specifier</emphasis> that says - how many decimal digits should be displayed for floating-point - numbers. This option has no effect for other types than - double. (Another function useful for formatting numbers is - <function>number_format</function>.) - </simpara> - </listitem> - <listitem> - <para> - A <emphasis>type specifier</emphasis> that says what type the - argument data should be treated as. Possible types: - <simplelist> - <member> - <literal>%</literal> - a literal percent character. No - argument is required. - </member> - <member> - <literal>b</literal> - the argument is treated as an - integer, and presented as a binary number. - </member> - <member> - <literal>c</literal> - the argument is treated as an - integer, and presented as the character with that ASCII - value. - </member> - <member> - <literal>d</literal> - the argument is treated as an - integer, and presented as a decimal number. - </member> - <member> - <literal>f</literal> - the argument is treated as a double, - and presented as a floating-point number. - </member> - <member> - <literal>o</literal> - the argument is treated as an - integer, and presented as an octal number. - </member> - <member> - <literal>s</literal> - the argument is treated as and - presented as a string. - </member> - <member> - <literal>x</literal> - the argument is treated as an integer - and presented as a hexadecimal number (with lowercase - letters). - </member> - <member> - <literal>X</literal> - the argument is treated as an integer - and presented as a hexadecimal number (with uppercase - letters). - </member> - </simplelist> - </para> - </listitem> - </orderedlist> - </para> - <simpara> - See also: <function>printf</function>, <function>sscanf</function>, - <function>fscanf</function>, and <function>number_format</function>. - </simpara> - </refsect1> - <refsect1> - <title>Examples</title> - <para> - <example> - <title><function>Sprintf</function>: zero-padded integers</title> - <programlisting role="php"> -$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); - </programlisting> - </example> - <example> - <title><function>Sprintf</function>: formatting currency</title> - <programlisting role="php"> -$money1 = 68.75; -$money2 = 54.35; -$money = $money1 + $money2; -// echo $money will output "123.1"; -$formatted = sprintf ("%01.2f", $money); -// echo $formatted will output "123.10" - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.strncasecmp"> - <refnamediv> - <refname>strncasecmp</refname> - <refpurpose> - Binary safe case-insensitive string comparison of the first n characters - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strncasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>len</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>strcasecmp</function>, with the - difference that you can specify the (upper limit of the) number of - characters (<parameter>len</parameter>) from each string to be - used in the comparison. If any of the strings is shorter than - <parameter>len</parameter>, then the length of that string will be - used for the comparison. - </para> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - See also <function>ereg</function>, <function>strcasecmp</function>, - <function>strcmp</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strcasecmp"> - <refnamediv> - <refname>strcasecmp</refname> - <refpurpose> - Binary safe case-insensitive string comparison - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - <example> - <title><function>strcasecmp</function> example</title> - <programlisting role="php"> -$var1 = "Hello"; -$var2 = "hello"; -if (!strcasecmp ($var1, $var2)) { - echo '$var1 is equal to $var2 in a case-insensitive string comparison'; -} - </programlisting> - </example> - </para> - <simpara> - See also <function>ereg</function>, <function>strcmp</function>, - <function>substr</function>, <function>stristr</function>, - <function>strncasecmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strchr"> - <refnamediv> - <refname>strchr</refname> - <refpurpose> - Find the first occurrence of a character - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strchr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is an alias for <function>strstr</function>, and is - identical in every way. - </para> - </refsect1> - </refentry> - - <refentry id="function.strcmp"> - <refnamediv> - <refname>strcmp</refname> - <refpurpose>Binary safe string comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strncasecmp</function>, - <function>strncmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strcspn"> - <refnamediv> - <refname>strcspn</refname> - <refpurpose> - Find length of initial segment not matching mask - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strcspn</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns the length of the initial segment of - <parameter>str1</parameter> which does <emphasis>not</emphasis> - contain any of the characters in <parameter>str2</parameter>. - </simpara> - <simpara> - See also <function>strspn</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strip-tags"> - <refnamediv> - <refname>strip_tags</refname> - <refpurpose>Strip HTML and PHP tags from a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strip_tags</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string - <parameter><optional>allowable_tags</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function tries to strip all HTML and PHP tags from the given - string. It errors on the side of caution in case of incomplete - or bogus tags. It uses the same tag stripping state machine as - the <function>fgetss</function> function. - </para> - <para> - You can use the optional second parameter to specify tags which - should not be stripped. - <note> - <para> - <parameter>Allowable_tags</parameter> was added in PHP 3.0.13, - PHP4B3. - </para> - </note> - </para> - </refsect1> - </refentry> - - <refentry id="function.stripcslashes"> - <refnamediv> - <refname>stripcslashes</refname> - <refpurpose> - Un-quote string quoted with <function>addcslashes</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stripcslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes stripped off. Recognizes - C-like <literal>\n</literal>, <literal>\r</literal> ..., octal - and hexadecimal representation. - <note> - <simpara> - Added in PHP4b3-dev. - </simpara> - </note> - </para> - <simpara> - See also <function>addcslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.stripslashes"> - <refnamediv> - <refname>stripslashes</refname> - <refpurpose> - Un-quote string quoted with <function>addslashes</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stripslashes</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns a string with backslashes stripped off. - (<literal>\'</literal> becomes <literal>'</literal> and so on.) - Double backslashes are made into a single backslash. - </para> - <simpara> - See also <function>addslashes</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.stristr"> - <refnamediv> - <refname>stristr</refname> - <refpurpose> - Case-insensitive <function>strstr</function> - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>stristr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns all of <parameter>haystack</parameter> from the first - occurrence of <parameter>needle</parameter> to the end. - <parameter>needle</parameter> and <parameter>haystack</parameter> - are examined in a case-insensitive manner. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - See also <function>strchr</function>, - <function>strrchr</function>, <function>substr</function>, and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strlen"> - <refnamediv> - <refname>strlen</refname> - <refpurpose>Get string length</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strlen</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the length of <parameter>string</parameter>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strnatcmp"> - <refnamediv> - <refname>strnatcmp</refname> - <refpurpose> - String comparisons using a "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strnatcmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - 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 <function>strcmp</function>) can be seen - below: - <informalexample> - <programlisting> -$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); -echo "Standard string comparison\n"; -usort($arr1,"strcmp"); -print_r($arr1); -echo "\nNatural order string comparison\n"; -usort($arr2,"strnatcmp"); -print_r($arr2); - </programlisting> - </informalexample> - The code above will generate the following output: - <informalexample> - <programlisting> -Standard string comparison -Array -( - [0] => img1.png - [1] => img10.png - [2] => img12.png - [3] => img2.png -) - -Natural order string comparison -Array -( - [0] => img1.png - [1] => img2.png - [2] => img10.png - [3] => img12.png -) - </programlisting> - </informalexample> - For more infomation see: Martin Pool's <ulink - url="&url.strnatcmp;">Natural Order String Comparison</ulink> - page. - </para> - <simpara> - Similar to other string comparison functions, this one returns - < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strncasecmp</function>, - <function>strnatcasecmp</function>, <function>strstr</function>, - <function>natsort</function> and <function>natcasesort</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strnatcasecmp"> - <refnamediv> - <refname>strnatcasecmp</refname> - <refpurpose> - Case insensitive string comparisons using a "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strnatcasecmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function implements a comparison algorithm that orders - alphanumeric strings in the way a human being would. The - behavior of this function is similar to - <function>strnatcmp</function>, except that the comparison is - not case sensitive. For more infomation see: Martin Pool's - <ulink url="&url.strnatcmp;">Natural Order String - Comparison</ulink> page. - </para> - <simpara> - Similar to other string comparison functions, this one returns - < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - See also <function>ereg</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strncasecmp</function>, - <function>strnatcmp</function>, and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strncmp"> - <refnamediv> - <refname>strncmp</refname> - <refpurpose> - Binary safe string comparison of the first n characters - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strncmp</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - <paramdef>int <parameter>len</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function is similar to <function>strcmp</function>, with the - difference that you can specify the (upper limit of the) number of - characters (<parameter>len</parameter>) from each string to be - used in the comparison. If any of the strings is shorter than - <parameter>len</parameter>, then the length of that string will be - used for the comparison. - </para> - <simpara> - Returns < 0 if <parameter>str1</parameter> is less than - <parameter>str2</parameter>; > 0 if <parameter>str1</parameter> - is greater than <parameter>str2</parameter>, and 0 if they are - equal. - </simpara> - <simpara> - Note that this comparison is case sensitive. - </simpara> - <simpara> - See also <function>ereg</function>, <function>strncasecmp</function>, - <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strcmp</function>, - and <function>strstr</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.str-pad"> - <refnamediv> - <refname>str_pad</refname> - <refpurpose>Pad a string to a certain length with another string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_pad</function></funcdef> - <paramdef>string <parameter>input</parameter></paramdef> - <paramdef>int <parameter>pad_length</parameter></paramdef> - <paramdef>string - <parameter><optional>pad_string</optional></parameter></paramdef> - <paramdef>int - <parameter><optional>pad_type</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This functions pads the <parameter>input</parameter> string on - the left, the right, or both sides to the specifed padding - length. If the optional argument - <parameter>pad_string</parameter> is not supplied, the - <parameter>input</parameter> is padded with spaces, otherwise it - is padded with characters from <parameter>pad_string</parameter> - up to the limit. - </para> - - <para> - Optional argument <parameter>pad_type</parameter> can be - STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If - <parameter>pad_type</parameter> is not specified it is assumed to - be STR_PAD_RIGHT. - </para> - - <para> - If the value of <parameter>pad_length</parameter> is negative or - less than the length of the input string, no padding takes - place. - </para> - - <para> - <example> - <title><function>str_pad</function> example</title> - <programlisting role="php"> -$input = "Alien"; -print str_pad($input, 10); // produces "Alien " -print str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" -print str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.strpos"> - <refnamediv> - <refname>strpos</refname> - <refpurpose> - Find position of first occurrence of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strpos</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - <paramdef>int - <parameter><optional>offset</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the numeric position of the first occurrence of - <parameter>needle</parameter> in the - <parameter>haystack</parameter> string. Unlike the - <function>strrpos</function>, this function can take a full - string as the <parameter>needle</parameter> parameter and the - entire string will be used. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - <note> - <para> - 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: - <informalexample> - <programlisting role="php"> -// in PHP 4.0b3 and newer: -$pos = strpos ($mystring, "b"); -if ($pos === false) { // note: three equal signs - // not found... -} - -// in versions older than 4.0b3: -$pos = strpos ($mystring, "b"); -if (is_string ($pos) && !$pos) { - // not found... -} - </programlisting> - </informalexample> - </para> - </note> - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - The optional <parameter>offset</parameter> parameter allows you - to specify which character in <parameter>haystack</parameter> to - start searching. The position returned is still relative to the - the beginning of <parameter>haystack</parameter>. - </para> - <para> - See also <function>strrpos</function>, - <function>strrchr</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strrchr"> - <refnamediv> - <refname>strrchr</refname> - <refpurpose> - Find the last occurrence of a character in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strrchr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function returns the portion of - <parameter>haystack</parameter> which starts at the last - occurrence of <parameter>needle</parameter> and goes until the - end of <parameter>haystack</parameter>. - </para> - <para> - Returns false if <parameter>needle</parameter> is not found. - </para> - <para> - If <parameter>needle</parameter> contains more than one - character, the first is used. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - <example> - <title><function>Strrchr</function> example</title> - <programlisting role="php"> -// get last directory in $PATH -$dir = substr (strrchr ($PATH, ":"), 1); - -// get everything after last newline -$text = "Line 1\nLine 2\nLine 3"; -$last = substr (strrchr ($text, 10), 1 ); - </programlisting> - </example> - </para> - <para> - See also <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.str-repeat"> - <refnamediv> - <refname>str_repeat</refname> - <refpurpose>Repeat a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_repeat</function></funcdef> - <paramdef>string <parameter>input</parameter></paramdef> - <paramdef>int <parameter>multiplier</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>input_str</parameter> repeated - <parameter>multiplier</parameter> times. - <parameter>multiplier</parameter> has to be greater than 0. - </para> - <example> - <title><function>Str_repeat</function> example</title> - <programlisting role="php"> -echo str_repeat ("-=", 10); - </programlisting> - </example> - <para> - This will output "-=-=-=-=-=-=-=-=-=-=". - </para> - <note> - <para> - This function was added in PHP 4.0. - </para> - </note> - </refsect1> - </refentry> - - <refentry id="function.strrev"> - <refnamediv> - <refname>strrev</refname> - <refpurpose>Reverse a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strrev</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter>, reversed. - </para> - </refsect1> - </refentry> - - <refentry id="function.strrpos"> - <refnamediv> - <refname>strrpos</refname> - <refpurpose> - Find position of last occurrence of a char in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strrpos</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>char <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns the numeric position of the last occurrence of - <parameter>needle</parameter> in the - <parameter>haystack</parameter> string. Note that the needle in - this case can only be a single character. If a string is passed - as the needle, then only the first character of that string will - be used. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - <note> - <para> - 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: - <informalexample> - <programlisting role="php"> -// in PHP 4.0b3 and newer: -$pos = strrpos ($mystring, "b"); -if ($pos === false) { // note: three equal signs - // not found... -} - -// in versions older than 4.0b3: -$pos = strrpos ($mystring, "b"); -if (is_string ($pos) && !$pos) { - // not found... -} - </programlisting> - </informalexample> - </para> - </note> - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - See also <function>strpos</function>, - <function>strrchr</function>, <function>substr</function>, - <function>stristr</function>, and <function>strstr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strspn"> - <refnamediv> - <refname>strspn</refname> - <refpurpose> - Find length of initial segment matching mask - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>strspn</function></funcdef> - <paramdef>string <parameter>str1</parameter></paramdef> - <paramdef>string <parameter>str2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - Returns the length of the initial segment of - <parameter>str1</parameter> which consists entirely of characters - in <parameter>str2</parameter>. - </simpara> - <para> - <informalexample> - <programlisting role="php"> -strspn ("42 is the answer, what is the question ...", "1234567890"); - </programlisting> - <para> - will return 2 as result. - </para> - </informalexample> - </para> - <simpara> - See also <function>strcspn</function>. - </simpara> - </refsect1> - </refentry> - - <refentry id="function.strstr"> - <refnamediv> - <refname>strstr</refname> - <refpurpose>Find first occurrence of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strstr</function></funcdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns all of <parameter>haystack</parameter> from the first - occurrence of <parameter>needle</parameter> to the end. - </para> - <para> - If <parameter>needle</parameter> is not found, returns false. - </para> - <para> - If <parameter>needle</parameter> is not a string, it is converted - to an integer and applied as the ordinal value of a character. - </para> - <para> - <note> - <para> - Note that this function is case-sensitive. For - case-insensitive searches, use <function>stristr</function>. - </para> - </note> - </para> - <para> - <example> - <title><function>Strstr</function> example</title> - <programlisting role="php"> -$email = 'sterling@designmultimedia.com'; -$domain = strstr ($email, '@'); -print $domain; // prints @designmultimedia.com - </programlisting> - </example> - </para> - <para> - See also <function>stristr</function>, - <function>strrchr</function>, <function>substr</function>, and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtok"> - <refnamediv> - <refname>strtok</refname> - <refpurpose>Tokenize string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtok</function></funcdef> - <paramdef>string <parameter>arg1</parameter></paramdef> - <paramdef>string <parameter>arg2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>strtok</function> is used to tokenize a string. That - is, if you have a string like "This is an example string" you - could tokenize this string into its individual words by using the - space character as the token. - <example> - <title><function>Strtok</function> example</title> - <programlisting role="php"> -$string = "This is an example string"; -$tok = strtok ($string," "); -while ($tok) { - echo "Word=$tok<br>"; - $tok = strtok (" "); -} - </programlisting> - </example> - </para> - <para> - Note that only the first call to strtok uses the string argument. - Every subsequent call to strtok only needs the token to use, as - it keeps track of where it is in the current string. To start - over, or to tokenize a new string you simply call strtok with the - string argument again to initialize it. Note that you may put - multiple tokens in the token parameter. The string will be - tokenized when any one of the characters in the argument are - found. - </para> - <para> - Also be careful that your tokens may be equal to "0". This - evaluates to false in conditional expressions. - </para> - <para> - See also <function>split</function> and - <function>explode</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtolower"> - <refnamediv> - <refname>strtolower</refname> - <refpurpose>Make a string lowercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtolower</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with all alphabetic - characters converted to lowercase. - </para> - <para> - 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. - </para> - <example> - <title><function>Strtolower</function> example</title> - <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; -$str = strtolower($str); -print $str; # Prints mary had a little lamb and she loved it so - </programlisting> - </example> - <para> - See also <function>strtoupper</function> - and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtoupper"> - <refnamediv> - <refname>strtoupper</refname> - <refpurpose>Make a string uppercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtoupper</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Returns <parameter>string</parameter> with all alphabetic - characters converted to uppercase. - </para> - <para> - 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. - </para> - <example> - <title><function>Strtoupper</function> example</title> - <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; -$str = strtoupper ($str); -print $str; # Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO - </programlisting> - </example> - <para> - See also <function>strtolower</function> - and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.str-replace"> - <refnamediv> - <refname>str_replace</refname> - <refpurpose> - Replace all occurrences of needle in haystack with str - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>str_replace</function></funcdef> - <paramdef>string <parameter>needle</parameter></paramdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>haystack</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function replaces all occurences of - <parameter>needle</parameter> in <parameter>haystack</parameter> - with the given <parameter>str</parameter>. If you don't need - fancy replacing rules, you should always use this function - instead of <function>ereg_replace</function>.</para> - <para> - <example> - <title><function>Str_replace</function> example</title> - <programlisting role="php"> -$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); - </programlisting> - </example> - </para> - <para> - This function is binary safe. - </para> - <note> - <para> - <function>Str_replace</function> was added in PHP 3.0.6, but was - buggy up until PHP 3.0.8. - </para> - </note> - <para> - See also <function>ereg_replace</function> and - <function>strtr</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.strtr"> - <refnamediv> - <refname>strtr</refname> - <refpurpose>Translate certain characters</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>strtr</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>string <parameter>from</parameter></paramdef> - <paramdef>string <parameter>to</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function operates on <parameter>str</parameter>, translating - all occurrences of each character in <parameter>from</parameter> - to the corresponding character in <parameter>to</parameter> and - returning the result. - </para> - <para> - If <parameter>from</parameter> and <parameter>to</parameter> are - different lengths, the extra characters in the longer of the two - are ignored. - <example> - <title><function>Strtr</function> example</title> - <programlisting role="php"> -$addr = strtr($addr, "é´¨?, "aao"); - </programlisting> - </example> - </para> - <para> - <function>strtr</function> can be called with only two - arguments. If called with two arguments it behaves in a new way: - <parameter>from</parameter> then has to be an array that contains - string -> string pairs that will be replaced in the source - string. <function>strtr</function> will always look for the - longest possible match first and will *NOT* try to replace stuff - that it has already worked on. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$trans = array ("hello" => "hi", "hi" => "hello"); -echo strtr("hi all, I said hello", $trans) . "\n"; - </programlisting> - </informalexample> - This will show: "hello all, I said hi", - </para> - <note> - <simpara> - This feature (two arguments) was added in PHP 4.0. - </simpara> - </note> - <para> - See also <function>ereg_replace</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.substr"> - <refnamediv> - <refname>substr</refname> - <refpurpose>Return part of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>substr</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>int <parameter>start</parameter></paramdef> - <paramdef>int - <parameter><optional>length</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Substr returns the portion of <parameter>string</parameter> - specified by the <parameter>start</parameter> and - <parameter>length</parameter> parameters. - </para> - <para> - If <parameter>start</parameter> is positive, the returned string - will start at the <parameter>start</parameter>'th position in - <parameter>string</parameter>, counting from zero. For instance, - in the string '<literal>abcdef</literal>', the character at - position <literal>0</literal> is '<literal>a</literal>', the - character at position <literal>2</literal> is - '<literal>c</literal>', and so forth. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", 1); // returns "bcdef" -$rest = substr ("abcdef", 1, 3); // returns "bcd" - </programlisting> - </informalexample> - </para> - <para> - If <parameter>start</parameter> is negative, the returned string - will start at the <parameter>start</parameter>'th character - from the end of <parameter>string</parameter>.</para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", -1); // returns "f" -$rest = substr ("abcdef", -2); // returns "ef" -$rest = substr ("abcdef", -3, 1); // returns "d" - </programlisting> - </informalexample> - </para> - <para> - If <parameter>length</parameter> is given and is positive, the - string returned will end <parameter>length</parameter> characters - from <parameter>start</parameter>. If this would result in a - string with negative length (because the start is past the end of - the string), then the returned string will contain the single - character at <parameter>start</parameter>. - </para> - <para> - If <parameter>length</parameter> is given and is negative, the - string returned will end <parameter>length</parameter> characters - from the end of <parameter>string</parameter>. If this would - result in a string with negative length, then the returned string - will contain the single character at - <parameter>start</parameter>. - </para> - <para> - Examples: - <informalexample> - <programlisting role="php"> -$rest = substr ("abcdef", 1, -1); // returns "bcde" - </programlisting> - </informalexample> - </para> - <para> - See also <function>strrchr</function> and - <function>ereg</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.substr-count"> - <refnamediv> - <refname>substr_count</refname> - <refpurpose>Count the number of substring occurrences</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>substr_count</function></funcdef> - <paramdef>string <parameter>haystrack</parameter></paramdef> - <paramdef>string <parameter>needle</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>substr_count</function> returns the number of times the - <parameter>needle</parameter> substring occurs in the - <parameter>haystack</parameter> string. - </para> - - <para> - <example> - <title><function>substr_count</function> example</title> - <programlisting> -print substr_count("This is a test", "is"); // prints out 2 - </programlisting> - </example> - </para> - </refsect1> - </refentry> - - <refentry id="function.substr-replace"> - <refnamediv> - <refname>substr_replace</refname> - <refpurpose>Replace text within a portion of a string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>substr_replace</function></funcdef> - <paramdef>string <parameter>string</parameter></paramdef> - <paramdef>string <parameter>replacement</parameter></paramdef> - <paramdef>int <parameter>start</parameter></paramdef> - <paramdef>int - <parameter><optional>length</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - <function>substr_replace</function> replaces the part of - <parameter>string</parameter> delimited by the - <parameter>start</parameter> and (optionally) - <parameter>length</parameter> parameters with the string given in - <parameter>replacement</parameter>. The result is returned. - </para> - <para> - If <parameter>start</parameter> is positive, the replacing will - begin at the <parameter>start</parameter>'th offset into - <parameter>string</parameter>. - </para> - <para> - If <parameter>start</parameter> is negative, the replacing will - begin at the <parameter>start</parameter>'th character from the - end of <parameter>string</parameter>. - </para> - <para> - If <parameter>length</parameter> is given and is positive, it - represents the length of the portion of - <parameter>string</parameter> which is to be replaced. If it is - negative, it represents the number of characters from the end of - <parameter>string</parameter> at which to stop replacing. If it - is not given, then it will default to strlen( - <parameter>string</parameter> ); i.e. end the replacing at the - end of <parameter>string</parameter>. - </para> - <para> - <example> - <title><function>Substr_replace</function> example</title> - <programlisting role="php"> -<?php -$var = 'ABCDEFGH:/MNRPQR/'; -echo "Original: $var<hr>\n"; - -/* These two examples replace all of $var with 'bob'. */ -echo substr_replace ($var, 'bob', 0) . "<br>\n"; -echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; - -/* Insert 'bob' right at the beginning of $var. */ -echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; - -/* These next two replace 'MNRPQR' in $var with 'bob'. */ -echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; -echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; - -/* Delete 'MNRPQR' from $var. */ -echo substr_replace ($var, '', 10, -1) . "<br>\n"; -?> - </programlisting> - </example> - </para> - <para> - See also <function>str_replace</function> and - <function>substr</function>. - </para> - <note> - <simpara> - <function>Substr_replace</function> was added in PHP 4.0. - </simpara> - </note> - </refsect1> - </refentry> - - <refentry id="function.trim"> - <refnamediv> - <refname>trim</refname> - <refpurpose> - Strip whitespace from the beginning and end of a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>trim</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function strips whitespace from the start and the end of a - string and returns the stripped string. The whitespace - characters it currently strips are: "\n", "\r", "\t", "\v", "\0", - and a plain space. - </para> - <para> - See also <function>chop</function>, <function>rtrim</function> and - <function>ltrim</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ucfirst"> - <refnamediv> - <refname>ucfirst</refname> - <refpurpose>Make a string's first character uppercase</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ucfirst</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Capitalizes the first character of <parameter>str</parameter> if - that character is alphabetic. - </para> - <para> - 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. - <example> - <title><function>Ucfirst</function> example</title> - <programlisting role="php"> -$text = 'mary had a little lamb and she loved it so.'; -$text = ucfirst ($text); // $text is now Mary had a little lamb - // and she loved it so. - </programlisting> - </example> - </para> - <para> - See also <function>strtoupper</function> and - <function>strtolower</function>. - </para> - </refsect1> - </refentry> - - <refentry id="function.ucwords"> - <refnamediv> - <refname>ucwords</refname> - <refpurpose> - Uppercase the first character of each word in a string - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>ucwords</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Capitalizes the first character of each word in - <parameter>str</parameter> if that character is alphabetic. - <example> - <title><function>ucwords</function> example</title> - <programlisting role="php"> -$text = "mary had a little lamb and she loved it so."; -$text = ucwords($text); // $text is now: Mary Had A Little - // Lamb And She Loved It So. - </programlisting> - </example> - <note> - <simpara> - 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). - </simpara> - </note> - </para> - <para> - See also <function>strtoupper</function>, - <function>strtolower</function> and <function>ucfirst</function>. - </para> - </refsect1> - </refentry> - - - <refentry id="function.wordwrap"> - <refnamediv> - <refname>wordwrap</refname> - <refpurpose> - Wraps a string to a given number of characters using a string - break character. - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>wordwrap</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - <paramdef>int - <parameter><optional>width</optional></parameter> - </paramdef> - <paramdef>string - <parameter><optional>break</optional></parameter> - </paramdef> - <paramdef>int - <parameter><optional>cut</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - Wraps the string <parameter>str</parameter> at the column number - specified by the (optional) <parameter>width</parameter> - parameter. The line is broken using the (optional) - <parameter>break</parameter> parameter. - </para> - <para> - <function>wordwrap</function> will automatically wrap at column - 75 and break using '\n' (newline) if <parameter>width</parameter> - or <parameter>break</parameter> are not given. - </para> - <para> - If the <parameter>cut</parameter> is set to 1, the string is - always wrapped at the specified width. So if you have a word - that is larger than the given width, it is broken appart. - (See second example). - <note> - <para> - The <parameter>cut</parameter> parameter was added in PHP 4.0.3. - </para> - </note> - </para> - <para> - <example> - <title><function>wordwrap</function> example</title> - <programlisting role="php"> -$text = "The quick brown fox jumped over the lazy dog."; -$newtext = wordwrap( $text, 20 ); - -echo "$newtext\n"; - </programlisting> - </example> - </para> - <para> - This example would display: - </para> - <para> - <informalexample> - <programlisting> -The quick brown fox -jumped over the lazy dog. - </programlisting> - </informalexample> - </para> - <para> - <example> - <title><function>wordwrap</function> example</title> - <programlisting role="php"> -$text = "A very long woooooooooooord."; -$newtext = wordwrap( $text, 8, "\n", 1); - -echo "$newtext\n"; - </programlisting> - </example> - </para> - <para> - This example would display: - </para> - <para> - <informalexample> - <programlisting> -A very -long -wooooooo -ooooord. - </programlisting> - </informalexample> - </para> - <para> - See also <function>nl2br</function>. - </para> - </refsect1> - </refentry> - - - </reference> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: ---> +<reference id="ref.strings"> + <title>String functions</title> + <titleabbrev>Strings</titleabbrev> + <partintro> + <simpara> + ì´ë¤ í¨ìë 모ë ë¤ìí ë°©ë²ì¼ë¡ 문ìì´ì ë¤ë£¬ë¤. ì ê· íí ì¹ì ê³¼ URL í¸ë¤ë§ ì¹ì ììì¢ ë ë¤ìíê³ í¹ë³í í¨ìë¤ì ë§ë ë³¼ ì ìë¤. + </simpara> + <para> + ì´ë»ê² 문ìì´ì´ ì ì©ëê³ , í¹í ìì ë°ì´íì í°ë°ì´í ê·¸ë¦¬ê³ ìì¤ì¼ì´í ìíì¤(escape sequence)ì ì´ë¤ ê´ê³ê° ìëì§ë ì´ ë©ë´ì¼ì + <link linkend="language.types">Types</link>ì¹ì ì <link linkend="language.types.string">Strings</link>í¸ì 참조í기 ë°ëë¤. + </para> + </partintro> + <refentry id="function.addcslashes"> + <refnamediv> + <refname>AddCSlashes</refname> + <refpurpose>Cííë¡ ë¬¸ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>addcslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>charlist</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>charlist</parameter>íë¼ë¯¸í°ì ëì¤ë 문ì ìì ë°±ì¬ëì¬ë¥¼ ìì¹ìí¨ ë¬¸ìì´ì ë°ííë¤. + ì´ í¨ìë C ì¤íì¼ì <literal>\n</literal>, <literal>\r</literal>ë±ì ì´ì¤ì¼ì´í íê³ , 32 ë³´ë¤ ìê±°ë 126 ë³´ë¤ í° ASCII ì½ëë íì§ì ííì¼ë¡ ë³íëë¤. + ìí벳과 ì«ì를 ìì¤ì¼ì´íí ë 주ìíë¼. + "\0..\37"ê³¼ ê°ì´ í¹ë³í ë²ì를 <parameter>charlist</parameter>ìì ì§ì í ì ìì¼ë©°, ì´ë ASCII ì½ë 0ê³¼ 31 ì¬ì´ì 모ë 문ì를 ì´ì¤ì¼ì´í í ê²ì´ë¤. + <example> + <title> + <function>Addcslashes</function>ì ì</title> + <programlisting role="php"> +$escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377"); + </programlisting> + </example> + <note> + <simpara> + PHP4b3-dev ìì ì¶ê°ëìë¤.</simpara> + </note> + </para> + <para> + <function>stripcslashes</function>, + <function>stripslashes</function>, + <function>htmlspecialchars</function>, + <function>htmlspecialchars</function>, ê·¸ë¦¬ê³ + <function>quotemeta</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.addslashes"> + <refnamediv> + <refname>AddSlashes</refname> + <refpurpose>ì¬ëì¬ë¡ 문ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>addslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°ì´í° ë² ì´ì¤ 쿼리ì ê°ì´ ì¸ì©ë ë¶ë¶ ìì ë°±ì¬ëì¬ë¥¼ ë¶ì¬ ë°ííë¤. + ì´ë° 문ììë ììë°ì´í (<literal>'</literal>), í°ë°ì´í(<literal>"</literal>),ë°±ì¬ëì¬(<literal>\</literal>), ê·¸ë¦¬ê³ NULL(null byte)ì´ ìë¤. + </para> + <para> + <function>stripslashes</function>, + <function>htmlspecialchars</function>, ê·¸ë¦¬ê³ + <function>quotemeta</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.bin2hex"> + <refnamediv> + <refname>bin2hex</refname> + <refpurpose> + ìì§ ë°ì´í°ë¥¼ 16ì§ì ííì¼ë¡ ë³ííë¤. </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>bin2hex</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì 16ì§ì ííì ê°ë ASCII ì¤í¸ë§ì¼ë¡ ë°ííë¤. ë³íì íì´-ëë¸(high-nibble)ì ììì¼ë¡ íë ë°ì´í¸ ìì´ì¦(byte0wise) ë°©ìì¼ë¡ ì§íëë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.chop"> + <refnamediv> + <refname>Chop</refname> + <refpurpose>ë¤ë¶ë¶ì 공백ì ì ê±°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chop</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë´ë¼ì¸(newline)ì í¬í¨íë ë·ë¶ë¶ì 공백ì ì ê±°í 문ìì´ì ë°ííë¤. + <example> + <title> + <function>Chop</function>ì ì</title> + <programlisting role="php"> +$trimmed = chop ($line); + </programlisting> + </example> + </para> + <note> + <para> + <function>chop</function> ì ë§ì§ë§ 문ì를 ì ê±°íë í(Perl)ì ìì´ìì <parameter>chop()</parameter> í¨ìì ë¤ë¥´ë¤. + </para> + </note> + <para> + <function>trim</function>, <function>ltrim</function>, + <function>rtrim</function>, ê·¸ë¦¬ê³ <function>chop</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.chr"> + <refnamediv> + <refname>Chr</refname> + <refpurpose>í¹ì 문ì를 ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chr</function> + </funcdef> + <paramdef>int <parameter>ascii</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>ascii</parameter>ì ìí´ ì ìë 문ì를 ëíë´ë 문ì를 ë°ííë¤. + <example> + <title> + <function>Chr</function> ì ì</title> + <programlisting role="php"> +$str .= chr (27); /* $str ì ëì ìì¤ì¼ì´í 문ì를 ì¶ê°íë¤. */ + +/* ëë¡ ë¤ìê³¼ ê°ì ìê° ëì± ì ì©íë¤. */ + +$str = sprintf ("The string ends in escape: %c", 27); + </programlisting> + </example> + ì´ í¨ìë <function>ord</function> í¨ìì ëìëë¤. + <literal>%c</literal> í¬ë©§ì ì¬ì©í <function>sprintf</function>í¨ì를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.chunk-split"> + <refnamediv> + <refname>chunk_split</refname> + <refpurpose>Split a string into smaller chunks</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>chunk_split</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>chunklen</optional> + </parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>end</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Can be used to split a string into smaller chunks which is useful + for e.g. converting <link linkend="function.base64-encode">base64_encode</link> output to + match RFC 2045 semantics. It inserts every + <parameter>chunklen</parameter> (defaults to 76) chars the string + <parameter>end</parameter> (defaults to "\r\n"). It returns the + new string leaving the original string untouched. + <example> + <title> + <function>Chunk_split</function> example</title> + <programlisting role="php"> +# format $data using RFC 2045 semantics + +$new_string = chunk_split (base64_encode($data)); + </programlisting> + </example> + This function is significantly faster than + <function>ereg_replace</function>. + <note> + <para> + This function was added in 3.0.6. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.convert-cyr-string"> + <refnamediv> + <refname>convert_cyr_string</refname> + <refpurpose> + í¤ë¦´ 문ì(Cyrillic character) ì ì ë¤ë¥¸ê²ì¼ë¡ ë³ííë¤. </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>convert_cyr_string</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>from</parameter> + </paramdef> + <paramdef>string <parameter>to</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 주ì´ì§ í¤ë¦´ 문ì ì íë를 ë¤ë¥¸ê²ì¼ë¡ ë³ííë¤. + <parameter>from</parameter>ê³¼ <parameter>to</parameter> ì¸ìë ìì¤ì íê² í¤ë¦´ 문ìì ì ëíë´ë íëì 문ìì´ë¤. + ì§ìëë íì ì ë¤ìê³¼ ê°ë¤: + <itemizedlist> + <listitem> + <simpara> + k - koi8-r + </simpara> + </listitem> + <listitem> + <simpara> + w - windows-1251 + </simpara> + </listitem> + <listitem> + <simpara> + i - iso8859-5 + </simpara> + </listitem> + <listitem> + <simpara> + a - x-cp866 + </simpara> + </listitem> + <listitem> + <simpara> + d - x-cp866 + </simpara> + </listitem> + <listitem> + <simpara> + m - x-mac-cyrillic + </simpara> + </listitem> + </itemizedlist> + </para> + </refsect1> + </refentry> + <refentry id="function.count-chars"> + <refnamediv> + <refname>count_chars</refname> + <refpurpose> + 문ìì´ì ì¬ì©ë ê¸ìì ê´í ì 보를 ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>count_chars</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef> + <parameter> + <optional>mode</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì ìë 0..255 ë°ì´í¸ì ëí ë¹ë ì를 ì¸ê³ , ê·¸ê²ì ë¤ìí ë°©ë²ì¼ë¡ ë°ííë¤. + ì íì ì¸ ë§¤ê°ë³ì <parameter>Mode</parameter> ë 0 ì¼ë¡ ê·¸ 기본ê°ì´ ì í´ì§ë¤. + <parameter>mode</parameter>ì ê°ì ë°ë¼ <function>count_chars</function> ì ë¤ìì¤ì íë를 ë°ííë¤: + <itemizedlist> + <listitem> + <simpara> + 0 - ë°ì´í¸-ê°(0..255)ì í¤ë¡ íê³ ë§¤ ë°ì´í¸ì ë¹ë를 ê°ì¼ë¡ íë ë°°ì´. + </simpara> + </listitem> + <listitem> + <simpara> + 1 - 0 ê³¼ ê°ì¼ë ë°ì´í¸-ê°ì ë¹ëê° 0ë³´í í° ê²ë¤ë§. + </simpara> + </listitem> + <listitem> + <simpara> + 2 - 0 ê³¼ ê°ì¼ë ë°ì´í¸-ê° ì´ 0 ì¸ ê²ë¤ë§. + </simpara> + </listitem> + <listitem> + <simpara> + 3 - ì¬ì©ë 모ë ë°ì´í¸-ê°ì í¬í¨íë 문ìì´ì´ ë°íëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + 4 - ì¬ì©ëì§ ìì ë³´ë ë°ì´í¸-ê°ì í¬í¨íë 문ìì´ì´ ë°íëë¤. + </simpara> + </listitem> + </itemizedlist> + </para> + <note> + <para> + ì´ í¨ìë PHP 4.0ë¶í° ì¶ê°ëìë¤. + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.crc32"> + <refnamediv> + <refname>crc32</refname> + <refpurpose>crc32 ë¤íìì 문ìì´ì ê³ì°íë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>crc32</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Generates the cyclic redundancy checksum polynomial of 32-bit lengths of + the <parameter>str</parameter>. This is usually used to validate the + integrity of data being trasmited. + </para> + <para> + <function>md5</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.crypt"> + <refnamediv> + <refname>crypt</refname> + <refpurpose>문ìì´ì DES-ìí¸í íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>crypt</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>salt</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>crypt</function>ì ì ëì¤ íì¤ì¸ <abbrev>DES</abbrev> ìí¸í 기ë²ì ì¬ì©íì¬ ë¬¸ìì´ì ìí¸í íë¤. + ì¸ìë¡ë ìí¸í ë 문ìì´ê³¼ ì íì ì¼ë¡ ìí¸íì ê¸°ë³¸ì´ ë ë 문ì salt 문ìì´ì´ ì¬ ì ìë¤. + ë ë§ì ì 보를 ìí´ ì ëì¤ì crypt í¨ìì ëí man page를 참조íë¼. + </para> + <simpara> + ë§ì½ salt ì¸ìê° ì£¼ì´ì§ì§ ìëë¤ë©´, PHPì ìí´ ë¬´ììë¡ ìì±ëë¤. + </simpara> + <simpara> + ëªëª ì´ìì²´ì ë íê°ì§ íì ì´ìì ìí¸í를 ì ê³µíë¤. ì¤ì ë¡ íì¤ DES ìí¸íë MD5ì 기ì´í ìí¸í ìê³ ë¦¬ì¦ì¼ë¡ ëì²´ë기ë íë¤. + ìí¸í íì ì slat ì¸ìì ìí´ ì ë°ëë¤. ì¸ì¤í¨ì, PHPë ìí¸í í¨ìì ê°ì© ì¬ë¶ë¥¼ ê²°ì íê³ , ë¤ë¥¸ ìí¸í íì ì ìí salt를 ì±íí ê²ì´ë¤. + ë§ì½ slatê° ì ê³µëì§ ìì¼ë©´, PHPë 기본ì ì¼ë¡ ëê¸ì DES salt를 ìë ìì±íê³ , ê·¸ë ì§ ìë¤ë©´ ì´ë MD5 í¸í saltê° ìì±ëë ê²½ì°ë¡ ìì¤í ì 기본 ìí¸í íì ì MD5ê° ëë¤. + PHPë CRYPT_SALT_LENGTH ë¼ë ìì를 ì¤ì íëë° ì´ë ìì¤í ì 2문ì salt를 ì ì©í ê²ì¸ì§ í¹ì ë 긴 12문ì MD5 salt를 ì ì©í ê²ì¸ì§ë¥¼ ìë ¤ì¤ë¤. + </simpara> + <simpara> + ë§ì½ ì ê³µë salt를 ì¬ì©íë¤ë©´, saltë íë²ë§ ìì±ëë¤ë ì ì 주ìíë¼. + ë§ì½ ì´ í¨ì를 ì¬ê·ì ì¼ë¡ í¸ì¶íë¤ë©´, ì´ë ê²ëª¨ìµ(appearance)ê³¼ ëì©ë©´ ì¢ ë íì¥ë ì미ìì 본ë¤ë©´ ë³´ììë ìí¥ì ë¼ì¹ ìë ìë¤. + </simpara> + <simpara> + 기본ì ì¸ DES ìí¸íì¸ <function>crypt</function>ë ì²ì ë 문ìê° salt ì¸ ë¬¸ìì´ì ì¶ë ¥íë¤. + </simpara> + <simpara> + crypt() í¨ìê° ë¤ìí ìí¸í íì ì ì§ìíë ìì¤í ìì, 주ì´ì§ íì ì´ ê°ë¥íëëì ë°ë¼ ë¤ì ììë 0 ì´ë 1 ë¡ ì§ì ëë¤. + </simpara> + <itemizedlist> + <listitem> + <simpara> + CRYPT_STD_DES - 2-문ì SALT를 ê°ì§ë 기본 DES ìí¸í + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_EXT_DES - 9문ì SALT 를 ê°ì§ë íì¥ë DES ìíí + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_MD5 - $1$ë¡ ììíë 12문ì SALT를 ê°ì§ë MD5 ìí¸í + </simpara> + </listitem> + <listitem> + <simpara> + CRYPT_BLOWFISH - $2$ë¡ ììíë 16문ì SALT를 ê°ë íì¥ë DES ìí¸í + </simpara> + </listitem> + </itemizedlist> + <simpara> + <function>crypt</function>ë one-way ìê³ ë¦¬ì¦ì ì¬ì©íë¯ë¡ decrypt í¨ìë ì¡´ì¬íì§ ìëë¤. + </simpara> + <simpara> + <function>md5</function> ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.echo"> + <refnamediv> + <refname>echo</refname> + <refpurpose>íë í¹ì ê·¸ ì´ìì 문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>echo</function> + </funcdef> + <paramdef>string <parameter>arg1</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>argn</optional>...</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + 무ë ì¸ì를 ì¶ë ¥íë¤. + </simpara> + <para> + <function>Echo</function> ë ì¤ì ë¡ í¨ìê° ìëë¤(ì´ë íëì ëê·ì§ ì¤í¸ëì³ì´ë¤.) ë°ë¼ì ì´ í¨ìì í¨ê» parantheses 를 ì¬ì©í íìê° ìë¤. + <example> + <title> + <function>Echo</function> ì</title> + <programlisting role="php"> +echo "Hello World"; + +echo "This spans +multiple lines. The newlines will be +output as well"; + +echo "This spans\nmultiple lines. The newlines will be\noutput as well."; + </programlisting> + </example> + </para> + <note> + <para> + ì¤ì ë¡ íë ì´ìì ì¸ì를 echo í¨ìì ì ë¬ íê³ ì íë¤ë©´, parentheses ë´ìì ì¸ì를 ê´í¸ë¡ ë«ì§ ë§ìì¼ íë¤. + In fact, if you want to pass more than one parameter to echo, + you must not enclose the parameters within parentheses. + </para> + </note> + <simpara> + <function>print</function>, + <function>printf</function>, ê·¸ë¦¬ê³ + <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.explode"> + <refnamediv> + <refname>explode</refname> + <refpurpose>문ìì´ì 주ì´ì§ 문ìì´ì 기주ì¼ë¡ ë¶ë¦¬íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>explode</function> + </funcdef> + <paramdef>string <parameter>separator</parameter> + </paramdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>limit</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + 문ìì´ì ë°°ì´ì ë°ííë©°, <parameter>string</parameter>ì ë¶ë¶ 문ìì´ë¡ íì±ë ê°ê°ì <parameter>separator</parameter>를 ê²½ê³ë¡ ëëì´ì§ë¤. + <parameter>limit</parameter>ê° ì§ì ë ê²½ì° ë°íë ë°°ì´ì ë§ì§ë§ ììê° ëë¨¸ì§ ë¬¸ìì´ì ì 체를 í¬í¨íë ìµë <parameter>limit</parameter>ê°ì ì리먼í¸ë¥¼ ê°ë ë°°ì´ì ë°ííë¤. + </para> + <note> + <para> + <parameter>limit</parameter> ì¸ìë PHP 4.0.1 ìì ì¶ê°ëìë¤. + </para> + </note> + <para> + <example> + <title> + <function>Explode</function> ì</title> + <programlisting role="php"> +$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; +$pieces = explode (" ", $pizza); + </programlisting> + </example> + </para> + <note> + <para> + ë¹ë¡ <function>implode</function> ë ê´ìµì ë°ë¼ ì¸ìì ìì¹ê° ì ìê° ë°ëì´ë íì©ì´ ëì§ë§, + <function>explode</function> ë ê·¸ë ì§ ëª»íë¤. + ë°ëì <parameter>separator</parameter> ê° <parameter>string</parameter> ì ìì ìì¹í´ì¼ë§ íë¤. + </para> + </note> + <para> + <function>split</function> ì + <function>implode</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.get-html-translation-table"> + <refnamediv> + <refname>get_html_translation_table</refname> + <refpurpose> + <function>htmlspecialchars</function> ì <function>htmlentities</function>ì ì¬ì©ë translation í ì´ë¸ì ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string + <function>get_html_translation_table</function> + </funcdef> + <paramdef>int <parameter>table</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>get_html_translation_table</function> ì <function>htmlspecialchars</function> ì <function>htmlentities</function>ì ë´ë¶ì ì¼ë¡ ì¬ì©ë translation í ì´ë¸ì ë°ííë¤. + ì¬ë¬ë¶ì´ ìíë í ì´ë¸ì ì§ì í ì ìëë¡ ëê°ì§ ìë¡ì´ ì ì(<parameter>HTML_ENTITIES</parameter>, <parameter>HTML_SPECIALCHARS</parameter>)ê° ìë¤. + ê·¸ë¦¬ê³ <function>htmlspecialchars</function> ì <function>htmlentities</function> í¨ìììì ë§ì°¬ê°ì§ë¡, ì íì ì¼ë¡ ë¹ì ì´ ì¬ì©íë quote_styleì ì§ì í ì ìë¤. + 기본ì ENT_COMPAT 모ëì´ë©°, <function>htmlspecialchars</function>ì ì¤ëª ëì´ ìë 모ë를 ì°¸ê³ í기 ë°ëë¤. + <example> + <title>Translation í ì´ë¸ ì</title> + <programlisting role="php"> +$trans = get_html_translation_table (HTML_ENTITIES); +$str = "Hallo & <Frau> & Krämer"; +$encoded = strtr ($str, $trans); + </programlisting> + </example> + <literal>$encoded</literal> ì ê°ì ë¤ìê³¼ ê°ë¤.: "Hallo &<sgmltag>amp</sgmltag>; &<sgmltag>lt</sgmltag>;Frau&<sgmltag>gt</sgmltag>; + &<sgmltag>amp</sgmltag>; Kr&<sgmltag>auml</sgmltag>;mer". + </para> + <para> + ìë¡ì´ ë°©ë²ì ìë²ìì í기 ìí´ <function>array_flip</function>ì ì¬ì©íë ê²ì´ë¤. + <informalexample> + <programlisting role="php"> +$trans = array_flip ($trans); +$original = strtr ($str, $trans); + </programlisting> + </informalexample> + The content of <literal>$original</literal> would be: "Hallo & + <Frau> & Krämer". + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + <para> + ë¤ìì ì°¸ê³ íë¼ : <function>htmlspecialchars</function>, + <function>htmlentities</function>, <function>strtr</function>, + ê·¸ë¦¬ê³ <function>array_flip</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.get-meta-tags"> + <refnamediv> + <refname>get_meta_tags</refname> + <refpurpose> + íì¼ë¡ ë¶í° 모ë ë©í íê·¸ ë´ì© ìì±ì ë°°ì´ë¡ ì¶ì¶íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_meta_tags</function> + </funcdef> + <paramdef>string <parameter>filename</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>use_include_path</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>filename</parameter>ì íì¼ì ì´ê³ <meta>ì í´ë¹íë ë¶ë¶ì ì¤ë¨ìë¡ í´ìíë¤. + <example> + <title>Meta Tags Example</title> + <programlisting role="html"> +<meta name="author" content="name"> +<meta name="tags" content="php3 documentation"> +</head> <!-- íì±ì´ ì¬ê¸°ì ë©ì¶ë¤. --> + </programlisting> + </example> + (ë¼ì¸ 구ë¶ì ëí´ ì£¼ìíë¼ - PHP ì ë ¥ì ëí íì±ì í ë íì¬ ìì¤í ì í¨ì를 ì¬ì©íë¯ë¡ Mac ììì íì¼ì´ Unix ììë ì ëë¡ ëìíì§ ìì ê²ì´ë¤). + </para> + <para> + ì´ë¦ ìì±ì ê´í ê°ì í¤ê° ëë©°, ì½í í¸ ìì±ì ê´í ê°ì ë°íëë ë°°ì´ì ê°ì´ ëì´ ë°°ì´ì ë¤ë£¨ê±°ë ê°ì ì ê·¼íëë° ìì½ê² 기본ì ì¸ ë°°ì´ í¨ì를 ì¬ì©í ì ìë¤. + name ìì± ê°ì ìë í¹ì 문ìë '_'ë¡ ì¹íëë©°, ë머ì§ë ì문ìë¡ ë³íëë¤. + </para> + <para> + <parameter>use_include_path</parameter> ì 1 ë¡ ì¸í íë©´, PHP ë íì¼ì 기본 include ê²½ë¡ìì ì°¾ì ì´ë ¤ê³ í ê²ì´ë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.hebrev"> + <refnamediv> + <refname>hebrev</refname> + <refpurpose> + ë ¼ë¦¬ì ì¸ í¤ë¸ë£¨ í ì¤í¸ë¥¼ ììë³¼ ì ìë í ì¤í¸ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>hebrev</function> + </funcdef> + <paramdef>string <parameter>hebrew_text</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>max_chars_per_line</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì íì ì¸ì <parameter>max_chars_per_line</parameter>ë ë¼ì¸ë¹ ì¶ë ¥ë ìµë ê¸ì ì를 ëíë¸ë¤. + ì´ í¨ìë breaking words를 무ìíë ¤ê³ íë¤.(The function tries to avoid breaking words.) + </para> + <para> + <function>hebrevc</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.hebrevc"> + <refnamediv> + <refname>hebrevc</refname> + <refpurpose> + ê°í 문ì를 í¬í¨í í¤íë¥ í ì¤í¸ë¥¼ ë³¼ ì ìë í ì¤í¸ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>hebrevc</function> + </funcdef> + <paramdef>string <parameter>hebrew_text</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>max_chars_per_line</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ê°í문ì(\n) 를 "<br>\n" ë¡ ë°ê¾¼ë¤ë ê²ì ì ì¸íë©´ <function>hebrev</function>ì ë¹ì·íë¤. + ì íì ì¸ ë§¤ê°ë³ì <parameter>max_chars_per_line</parameter>ë ì¶ë ¥ë ë¼ì¸ë¹ ìµëì 문ì ì를 ê°ë¦¬í¨ë¤. + ì´ í¨ìë breaking words를 무ìíë¤.(The function tries to avoid breaking words.) + </para> + <para> + <function>hebrev</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.htmlentities"> + <refnamediv> + <refname>htmlentities</refname> + <refpurpose> + í´ë¹ëë 모ë 문ì를 HTML ìí°í° ííë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>htmlentities</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë HTML ìí°í°ì í´ë¹íë 모ë 문ìê° HTML ìí°ëë¡ ë³íëë¤ë ì ì ì ì¸íê³ ë + <function>htmlspecialchars</function> ì 모ë ë°©ë©´ìì ì¼ì¹íë¤. + <function>htmlspecialchars</function>ì ë¹ì·íê² ì íì ì¸ ëë²ì§¸ì ì¸ì를 ì·¨íëë° ì´ë + ìì ë°ì´íì í° ë°ì´í를 ì´ë»ê² ë¤ë£°ê¹ë¥¼ ì§ìíë¤. + <constant>ENT_COMPAT</constant>(기본ê°)ì í°ë°ì´í ë§ì ê°ê¾¸ê³ ìì ë°ì´íë ë´ë²ë ¤ ëë©°, + <constant>ENT_QUOTES</constant>ë ìì ë°ì´íì í° ë°ì´í 모ë를 ë°ê¾¸ê³ , + <constant>ENT_NOQUOTES</constant>ë ìì ë°ì´íì í° ë°ì´í 모ë를 ë°ê¾¸ì§ ìê³ ê·¸ëë¡ ë´ë²ë ¤ ëë¤. + </para> + <para> + íì¬ ISO-8859-1 문ì ì ì´ ì¬ì©ëë¤. + ì íì¸ìì¸ ëë²ì§¸ ì¸ìë PHP 3.0.17 ê³¼ PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + <para> + <function>htmlspecialchars</function> ì + <function>nl2br</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.htmlspecialchars"> + <refnamediv> + <refname>htmlspecialchars</refname> + <refpurpose> + í¹ì 문ì를 HTML ìí°í° ííë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>htmlspecialchars</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter> + <optional>quote_style</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ë¤ 문ììì HTML ë´ì´ì í¹ë³í ì¤ìì±ì ê°ì§ë©°, ê·¸ 문ìì ì미를 ë³´ì¡´íë ¤ë©´, HTML ìí°í°ë¡ì ííëì´ì ¸ì¼ íë¤. + ì´ í¨ìë ì´ë ê² ë§ë¤ì´ì§ ë³íë 문ìì´ì ë°ííë¤-ì´ë¬í ë²ìì ì¹ íë¡ê·¸ëë°ìì ë§¤ì° ì ì©íë¤. + ë§ì½ 모ë HTML 문ì ìí°í°ë¥¼ ë²ìí íìê° ìë¤ë©´ <function>htmlentities</function>를 ëì ì¬ì©í기 ë°ëë¤. + </para> + <simpara> + ì´ í¨ìë ê²ìíì´ë ë°©ëª ë¡ ë±ì íë¡ê·¸ë¨ìì ì¬ì©ìê° HTML ì í¬í¨íë í ì¤í¸ì ì¬ì©ì ë§ëë° ì ì©íë¤. + ì íì ì¸ ëë²ì§¸ ì¸ì quote_style ì ìì ë°ì´íì í° ë°ì´í를 ì´ë»ê² ì¬ì©í ì§ë¥¼ ë§í´ì¤ë¤. + 기본 모ëì¸ ENT_COMPAT ì ë¨ì§ í° ë°ì´íë§ ë³ííê³ ìì ë°ì´íë ê·¸ëë¡ ë´ë²ë ¤ ëë¤. + ENT_QUOTES ê° ì§ì ëë©´, ìì ë°ì´íì í° ë°ì´í 모ë를 ë²ìíë©°, + ENT_NOQUOTESë ìì ë°ì´íì í° ë°ì´í 모ë를 ë²ìíì§ ìëë¤. + </simpara> + <para> + ë²ìì´ ì´ë£¨ì´ì§ë ííë ë¤ìê³¼ ê°ë¤ : + <itemizedlist> + <listitem> + <simpara> + '&' (ì°í¼ìë) ë '&amp;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '"' (í°ë°ì´í) ë ENT_NOQUOTES ì´ ì§ì ëì´ ìì§ ìì ë '&quot;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ''' (ììë°ì´í) ë¨ì§ ENT_QUOTES ë§ ì§ì ê´´ì´ ìì ë '&#039;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '<' (ë³´ë¤ ìë¤) ë '&lt;' ì´ ëë¤. + </simpara> + </listitem> + <listitem> + <simpara> + '>' (ë³´ë¤ í¬ë¤) ë '&gt;' ì´ ëë¤. + </simpara> + </listitem> + </itemizedlist> + <example> + <title> + <function>htmlspecialchars</function> ì</title> + <programlisting role="php"> +$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); + </programlisting> + </example> + </para> + <para> + ì´ í¨ìë ìì ëª ìë ê±° ì´ì¸ìë ì´ë¤ ê²ë ë²ìíì§ ìëë¤ë ê²ì ëª ì¬íë¼. + ìì í ìí°í° ë²ìì ìí´ìë <function>htmlentities</function>ì ì°¸ê³ íë¼. + ëí ì íì ì¸ ëë² ì§¸ ì¸ì ë PHP 3.0.17 ê³¼ PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + <para> + <function>htmlentities</function> ì + <function>nl2br</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.implode"> + <refnamediv> + <refname>implode</refname> + <refpurpose>문ìì´ë¡ í¨ì ì리먼í¸ë¥¼ ì°ê²°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>implode</function> + </funcdef> + <paramdef>string <parameter>glue</parameter> + </paramdef> + <paramdef>array <parameter>pieces</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ê°ê°ì ë°°ì´ ìì ì¬ì´ì ì¤í¸ë§ì í¬í¨íë 문ìì´ì ë°ííë¤. + <example> + <title> + <function>Implode</function> example</title> + <programlisting role="php"> +$colon_separated = implode (":", $array); + </programlisting> + </example> + </para> + <note> + <para> + <function>implode</function> ë ê´ìµì ë°ë¼ ì¸ìì ìì¹ê° ì ìê° ë°ëì´ë íì©ì´ ëì§ë§, + <function>explode</function> ìì í¼ëì ë§ê¸° ìí´ ì´ ë¬¸ìì ìì ë ììë¡ ì¸ì를 ì¬ì©íë ê²ì ê¶ì¥íë¤. + </para> + </note> + <simpara> + <function>explode</function>, <function>join</function>, + ê·¸ë¦¬ê³ <function>split</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.join"> + <refnamediv> + <refname>join</refname> + <refpurpose>문ìì´ë¡ ë°°ì´ì ìì를 ì°ê²°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>join</function> + </funcdef> + <paramdef>string <parameter>glue</parameter> + </paramdef> + <paramdef>array <parameter>pieces</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>join</function> ì <function>implode</function> ì ë³ì¹ì´ë©°, 모ë ë©´ìì ì¼ì¹íë¤. + </simpara> + <simpara> + <function>explode</function>, <function>implode</function>, + ê·¸ë¦¬ê³ <function>split</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.levenshtein"> + <refnamediv> + <refname>levenshtein</refname> + <refpurpose> + ë 문ìì´ ê°ì Levenshtein ëì¤í´ì¤ë¥¼ ê³ì°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>cost_ins</parameter> + </paramdef> + <paramdef>int <parameter>cost_rep</parameter> + </paramdef> + <paramdef>int <parameter>cost_del</parameter> + </paramdef> + </funcprototype> + <funcprototype> + <funcdef>int <function>levenshtein</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>function <parameter>cost</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function returns the Levenshtein-Distance between the + two argument strings or -1, if one of the argument strings + is longer than the limit of 255 characters (255 should be + more than enough for name or dictionary comparison, and + nobody serious would be doing genetic analysis with PHP). + </para> + <para> + The Levenshtein distance is defined as the minimal number of + characters you have to replace, insert or delete to transform + <parameter>str1</parameter> into <parameter>str2</parameter>. + The complexity of the algorithm is <literal>O(m*n)</literal>, + where <literal>n</literal> and <literal>m</literal> are the + length of <parameter>str1</parameter> and + <parameter>str2</parameter> (rather good when compared to + <function>similar_text</function>, which is O(max(n,m)**3), + but still expensive). + </para> + <para> + In its simpelest form the function will take only the two + strings as parameter and will calculate just the number of + insert, replace and delete operations needed to transform + <parameter>str1</parameter> into <parameter>str2</parameter>. + </para> + <para> + A second variant will take three additional parameters that + define the cost of insert, replace and delete operations. + This is more general and adaptive than variant one, but not + as efficient. + </para> + <para> + The third variant (which is not implemented yet) will be + the most general and adaptive, but also the slowest alternative. + It will call a user-supplied function that will determine the + cost for every possible operation. + </para> + <para> + The user-supplied function will be called with the following + arguments: + <itemizedlist> + <listitem> + <simpara> + operation to apply: 'I', 'R' or 'D' + </simpara> + </listitem> + <listitem> + <simpara> + actual character in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + actual character in string 2 + </simpara> + </listitem> + <listitem> + <simpara> + position in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + position in string 2 + </simpara> + </listitem> + <listitem> + <simpara> + remaining characters in string 1 + </simpara> + </listitem> + <listitem> + <simpara> + remaining characters in string 2 + </simpara> + </listitem> + </itemizedlist> + The user-supplied function has to return a positive integer + describing the cost for this particular operation, but it + may decide to use only some of the supplied arguments. + </para> + <para> + The user-supplied function approach offers the possibility to + take into account the relevance of and/or difference between + certain symbols (characters) or even the context those symbols + appear in to determine the cost of insert, replace and delete + operations, but at the cost of loosing all optimizations done + regarding cpu register utilization and cache misses that have + been worked into the other two variants. + </para> + <para> + See also <function>soundex</function>, + <function>similar_text</function> + and <function>metaphone</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.ltrim"> + <refnamediv> + <refname>ltrim</refname> + <refpurpose> + 문ìì´ ììë¶ë¶ìì 공백ì ì ê±°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ltrim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 문ìì´ ìë¶ë¶ì 공백ì ì ê±°íë©°, 공백 ì ê±°ë 문ìì´ì ë°ííë¤. + ì¼ë°ì ì¼ë¡ ì ê±°ëë 문ìë ë¤ìê³¼ ê°ë¤ : "\n", "\r", "\t", "\v", "\0", ê·¸ë¦¬ê³ ê³µë°± + </para> + <para> + <function>chop</function>, <function>rtrim</function>, ê·¸ë¦¬ê³ + <function>trim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.md5"> + <refnamediv> + <refname>md5</refname> + <refpurpose>문ìì´ì md5 í´ì¬ë¥¼ ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>md5</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. MD5 Message-Digest Algorithm</ulink>ì ì¬ì©íì¬ + <parameter>str</parameter>ì MD5 í´ì¬ë¥¼ ê³ì°íë¤. + </para> + <para> + <function>crc32</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.metaphone"> + <refnamediv> + <refname>Metaphone</refname> + <refpurpose>문ìì´ì ë©íí° í¤(metaphone key) 를 ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>metaphone</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì ë©íí° í¤(metaphone key) 를 ê³ì°íë¤. + </para> + <para> + <function>soundex</function>ì ë¹ì·íê² ë©íí°(metaphone)ì ì ì¬í ë°ìì ë¨ì´ì ëí ëì¼í í¤ë¥¼ ìì±íë¤. + ì´ í¨ìë ìì´ ë°ìì 기본 ë²ì¹ì ì¬ì©íë<function>soundex</function>ë³´ë¤ í¨ì¬ ì ííë¤. + ë©íí° ìì± í¤ë ê°ë³ê¸¸ì´ì´ë¤. + </para> + <para> + ë©íí°ì Lawrence Philips <lphilips@verity.com>ì ìí´ ê°ë°ëìë¤. + ì´ë ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995]ì ìì ëì´ ìë¤. + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.nl2br"> + <refnamediv> + <refname>nl2br</refname> + <refpurpose>ë´ë¼ì¸ì HTML ë¼ì¸ ë¸ë ì´í¬(<BR>)ë¡ ë³ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>nl2br</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë´ ë¼ì¸ ì ì '<BR>' ê° ì½ì ë <parameter>string</parameter>ì ë°ííë¤. + </para> + <para> + <function>htmlspecialchars</function>, + <function>htmlentities</function> ê·¸ë¦¬ê³ + <function>wordwrap</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ord"> + <refnamediv> + <refname>Ord</refname> + <refpurpose>문ìì ASCII ê°ì ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ord</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 첫ë²ì§¸ 문ìì ASCII ê°ì ë°ííë¤. + ì´ í¨ìë <function>chr</function>ì ë³´ì¶©íë¤. + <example> + <title> + <function>Ord</function> ì</title> + <programlisting role="php"> +if (ord ($str) == 10) { + echo "The first character of \$str is a line feed.\n"; +} + </programlisting> + </example> + </para> + <simpara> + <function>chr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.parse-str"> + <refnamediv> + <refname>parse_str</refname> + <refpurpose>문ìì´ì ë³ìë¡ íì±íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>parse_str</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>array <parameter> + <optional>arr</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + 문ìì´ <parameter>str</parameter>ì ë§ì¹ URLì íµí´ ì¨ ì§ì문ì¸ê² ì²ë¼ íì±íê³ + ì ì ë³ìë¡ ë³ì를 ì§ì íë¤. + ë§ì½ ëë²ì§¸ 매ê°ë³ì <parameter>arr</parameter>ì´ ì¡´ì¬íë©´, + ë³ìë <parameter>arr</parameter>ì´ë¦ì ê°ë ë°°ì´ì ììë¡ ì ì¥ëë¤. + </para> + <para> + <example> + <title> + <function>parse_str</function>ì ì¬ì© + </title> + <programlisting role="php"> +$str = "first=value&second[]=this+works&second[]=another"; +parse_str($str); +echo $first; /* "value" 를 ì¶ë ¥ */ +echo $second[0]; /* "this works" 를 ì¶ë ¥ */ +echo $second[1]; /* "another" 를 ì¶ë ¥ */ + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.print"> + <refnamediv> + <refname>print</refname> + <refpurpose>문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef> + <function>print</function> + </funcdef> + <paramdef>string <parameter>arg</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>arg</parameter>ì ì¶ë ¥íë¤. + </simpara> + <simpara> + <function>echo</function>, <function>printf</function>, + ê·¸ë¦¬ê³ <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.printf"> + <refnamediv> + <refname>printf</refname> + <refpurpose>í¬ë©§ë 문ìì´ì ì¶ë ¥íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>printf</function> + </funcdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>mixed + <parameter> + <optional>args</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>format</parameter>ì ë°ë¼ ì¶ë ¥ì ë§ë¤ì´ ë´ë©°, ì´ë <function>sprintf</function>를 ìí 문ìì ì¤ëª ëì´ ìë¤. + </simpara> + <simpara> + <function>print</function>, <function>sprintf</function>, + <function>sscanf</function>, <function>fscanf</function>, + ê·¸ë¦¬ê³ <function>flush</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.quoted-printable-decode"> + <refnamediv> + <refname>quoted_printable_decode</refname> + <refpurpose> + ì¸ì©ë ì¶ë ¥ê°ë¥í 문ìì´ì 8ë¹í¸ 문ìì´ë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string + <function>quoted_printable_decode</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + ì´ í¨ìë ëì½ëë ì¸ì©ë ì¶ë ¥ ê°ë¥í 문ìì´ì í´ë¹íë 8ë¹í¸ ë°ì´ë리 문ìì´ì ë°ííë¤. + ì´ í¨ìë ìëíëë° IMAP 모ëì´ íì ìë¤ë ì ì ì ì¸íë©´, <function>imap_qprint</function>ì ì ì¬íë¤. + </simpara> + </refsect1> + </refentry> + <refentry id="function.quotemeta"> + <refnamediv> + <refname>quotemeta</refname> + <refpurpose>ë©í 문ì를 ì¸ì©íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>quotemeta</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <screen>. \\ + * ? [ ^ ] ( $ )</screen>ì 문ìë¤ ì ì + <parameter>str</parameter>ì ë°±ì¬ëì¬ ë¬¸ì(<literal>\</literal>) 를 ì¬ì©í ë²ì ¼ì ë°ííë¤. + </para> + <simpara> + <function>addslashes</function>, + <function>htmlentities</function>, + <function>htmlspecialchars</function>, + <function>nl2br</function>, ê·¸ë¦¬ê³ + <function>stripslashes</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.rtrim"> + <refnamediv> + <refname>rtrim</refname> + <refpurpose>문ìì´ ëì 공백ì ì ê±°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcdef>string <function>rtrim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcsynopsis> + <para> + ì¸ìë¡ ëì´ì¨ 문ìì´ìì ë´ë¼ì¸ì í¬í¨íë 문ìì´ ëì 공백ì ì ê±°í 문ìì´ì ë°í íë©°, + ì´ë <function>chop</function>ì ë³ì¹ì´ë¤. + <example> + <title> + <function>rtrim</function> ì</title> + <programlisting role="php"> +$trimmed = rtrim ($line); + </programlisting> + </example> + </para> + <para> + <function>trim</function>, <function>ltrim</function>, ê·¸ë¦¬ê³ + <function>rtrim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.sscanf"> + <refnamediv> + <refname>sscanf</refname> + <refpurpose>í¬ë©§ì´ ë°ë¼ì ì ë ¥ì 문ìì´ë¡ë¶í° íì±íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>sscanf</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>var1</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>sscanf</function> í¨ìë <function>printf</function>ì ì ë ¥ ì ì¬ì±ì ê°ì§ë¤. + <function>Sscanf</function>sms <parameter>str</parameter> 문ìì´ë¡ ë¶í° ì ë ¥ì ì½ì´ + í¹ì í <parameter>format</parameter> ì ë°ë¼ ì¸í°ë½í¸íë¤. + - <function>Sscanf</function> reads from the string <parameter>str</parameter> + and interprets it according to the specified <parameter>format</parameter>. + ë§ì½ ëê°ì 매ê°ë³ìë§ì´ ì´ í¨ìë¡ ì ë¬ëë¤ë©´, íì±ë ê°ì ë°°ì´ë¡ì ë°íëë¤. + <example> + <title> + <function>Sscanf</function> ì</title> + <programlisting role="php"> +// ìë¦¬ì¼ ë²í¸ë¥¼ ì»ëë¤. +$serial = sscanf("SN/2350001","SN/%d"); +// ì ì¡°ì¼ì ì§ì íë¤. +$mandate = "January 01 2000"; +list($month, $day, $year) = sscanf($mandate,"%s %d %d"); +echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n"; + </programlisting> + </example> + ì íì ì¸ ë§¤ê°ë³ìê° ì ë¬ëë©´, í¨ìë í ë¹ë ê°ì ëí ì를 ë°ííë¤. + ì íì ì¸ ë§¤ê°ë³ìë ë°ëì 참조ì ìí´ ì ë¬ëì´ì¼ íë¤. + <example> + <title> + <function>Sscanf</function> - ì íì ì¸ ë§¤ê°ë³ì ì¬ì©í기</title> + <programlisting role="php"> +// ìê° ì 보를 ì»ê³ DocBookì ì¸í¸ë¦¬ë¥¼ íì±ííë¤. +$auth = "24\tLewis Carroll"; +$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); +echo "<author id='$id'> + <firstname>$first</firstname> + <surname>$last</surname> +</author>\n"; + </programlisting> + </example> + </para> + <para> + <function>fscanf</function>, <function>printf</function>, + ê·¸ë¦¬ê³ <function>sprintf</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.setlocale"> + <refnamediv> + <refname>setlocale</refname> + <refpurpose>ì§ìì 보를 ì§ì íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>setlocale</function> + </funcdef> + <paramdef>string <parameter>category</parameter> + </paramdef> + <paramdef>string <parameter>locale</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>Category</parameter>ë ì§ì ì¸í ì ìí´ ìí¥ì ë°ë í¨ìì ë²ì£¼ë¥¼ í¹ì±í íë 문ìì´ì´ë¤ : + <itemizedlist> + <listitem> + <simpara> + LC_ALL - ì´í ëì¤ë 모ë ê²ì ìí´ + </simpara> + </listitem> + <listitem> + <simpara> + LC_COLLATE - 문ìì´ ë¹êµë¥¼ ìí¨ - íµìì ì¼ë¡ PHPììë ì¤í»ì¸ì§ ìëë¤ + </simpara> + </listitem> + <listitem> + <simpara> + LC_CTYPE - <function>strtoupper</function>ì ê°ì´ 문ì ì ííì ë³íì ìí´. + </simpara> + </listitem> + <listitem> + <simpara> + LC_MONETARY - localeconv() 를 ìí´ - íµìì ì¼ë¡ PHPììë ì¤í»ì¸ì§ ìëë¤ + </simpara> + </listitem> + <listitem> + <simpara> + LC_NUMERIC - ìì§ êµ¬ë¶ì를 ìí´ + </simpara> + </listitem> + <listitem> + <simpara> + LC_TIME - <function>strftime</function>ì í¨ê» ë ìì ìê° í매í ì ìí´ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + ë§ì½ <parameter>locale</parameter>ì´ ë¹ ë¬¸ìì´ <literal>""</literal>ì¼ ê²½ì° + ë¡ì¼ì¼ ì´ë¦ì ì ì¹´íê³ ë¦¬ì ì´ë¦ê³¼ ê°ì ì´ë¦ì ê°ë íê²½ë³ìë "LANG"ì¼ë¡ ë¶í° ì¸í ëë¤. + </para> + <para> + ë§ì½ ë¡ì¼ì¼ì´ 0 ì´ê±°ë 문ì <literal>"0"</literal>ì¼ ê²½ì°, + ë¡ì¼ì¼ ì¸í ì ìí¥ì ë°ì§ ìê³ ë¨ì§ íì¬ì ì¤ì ë§ì´ ë°íëë¤. + </para> + <para> + Setlocale ì ìë¡ì´ íì¬ ë¡ì¼ì¼ì´ë, ë¡ì¼ì¼ 기ë¥ì´ íë«í¼ì´ì ìíëì§ ìê±°ë, + í¹ì ë¡ì¼ì¼ì´ ì¡´ì¬íì§ ìê±°ë í¹ì ì¹´í ê³ ë¦¬ ì´ë¦ì´ ì í¨íì§ ìì ê²½ì° ê±°ì§ì ë°ííë¤. + ì í¨íì§ ìì ì¹´í ê³ ë¦¬ ì´ë¦ ìì ê²½ê³ ë©ìì§ë¥¼ ì¼ê¸°ìí¨ë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.similar-text"> + <refnamediv> + <refname>similar_text</refname> + <refpurpose> + ë 문ìì´ ê°ì ì ì¬ì±ì ê³ì°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>similar_text</function> + </funcdef> + <paramdef>string <parameter>first</parameter> + </paramdef> + <paramdef>string <parameter>second</parameter> + </paramdef> + <paramdef>double + <parameter> + <optional>percent</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ë Oliver [1993]ì ì¤ëª ë ê²ì²ë¼ ë 문ìì´ ê°ì ì ì¬ì±ì ê³ì°íë¤. + ì´ ìíì Oliver's ìì¬ì½ëìì ì²ë¼ ì¤íì ì¬ì©íë ê²ì´ ìëë¼, + ì ì²´ íë¡ì¸ì¤ìì ìë를 ëì´ê±°ë ëë¦¬ê² í ìë ìë ì¬ê·ì ì¸ í¸ì¶ì + ì¬ì©í¨ì 주ìíë¼. + ëí ì´ ìê³ ë¦¬ì¦ì ë³µì¡ëë O(N**3) ì´ë©° Nì ê°ì¥ 긴 문ìì´ì 길ì´ë¥¼ ëíë¸ë¤. + </para> + <para> + ì¸ë²ì§¸ ì¸ìë 참조ì ìí ì ë¬ì í¨ì¼ë¡ì, <function>similar_text</function>ë + ë 문ìì´ê°ì ì ì¬ì±ì í¼ì¼í°ì§ë¡ ê³ì°í ì ìë¤. + ì´ í¨ìë ë 문ìì´ì 매ì¹íë 문ì ì를 리í´íë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.soundex"> + <refnamediv> + <refname>soundex</refname> + <refpurpose>문ìì´ì soundex í¤ë¥¼ ê³ì°íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>soundex</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì soundexí¤ë¥¼ ê³ì°íë¤. + </para> + <para> + Soundex í¤ë ë¨ì´ì ë°ìì´ ê°ì¼ë©´, ê°ì soundex í¤ë¥¼ ìì±íë í¹ì±ì ê°ì§ë¤. + ê·¸ë¦¬ê³ ì´ë¡ì¸í´ ë°ì´íë² ì´ì¤ìì ë°ìì ìì§ë§ ì¤í ì 모르ë ë¨ì´ë¥¼ ì½ê² ì°¾ì ì ê° ìë¤. + ì´ soundex í¨ìë ìíë²³ 문ìë¡ ììíë 4 문ì 길ì´ì 문ìì´ì ë°ííë¤. + </para> + <para> + ì´ë ê² í¹ë³í soundex í¨ìë "The Art Of Computer Programming, vol. 3: Sorting And + Searching", Addison-Wesley (1973), pp. 391-392 ìì Donald Knuth ì ìí´ ê¸°ì ëìë¤. + </para> + <para> + <example> + <title>Soundex ì</title> + <programlisting role="php"> +soundex ("Euler") == soundex ("Ellery") == 'E460'; +soundex ("Gauss") == soundex ("Ghosh") == 'G200'; +soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; +soundex ("Knuth") == soundex ("Kant") == 'K530'; +soundex ("Lloyd") == soundex ("Ladd") == 'L300'; +soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.sprintf"> + <refnamediv> + <refname>sprintf</refname> + <refpurpose>í¬ë©§ë 문ìì´ì ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>sprintf</function> + </funcdef> + <paramdef>string <parameter>format</parameter> + </paramdef> + <paramdef>mixed + <parameter> + <optional>args</optional> + </parameter>... + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + í¬ë§· 문ìì¸<parameter>format</parameter>ì ë°ë¼ì ìì±ë 문ìì´ì ë°ííë¤. + <parameter>format</parameter>. + </simpara> + <simpara> + í¬ë§· ì¤í¸ë§ì 0 í¹ì ë¤ë¥¸ ì§ìë¬¸ì´ ì¬ ì ìë¤: + ì§ì ê²°ê³¼ë¡ ë³µì¬ëë ì¼ë°ì ì¸ ë¬¸ì(<literal>%</literal>ì í¬í¨íì¬)ì + <emphasis>ë³í í¹ì 문ì(conversion specifications)</emphasis>, + ê°ê°ì ìì ì 매ê°ë³ì를 í¨ì¹íë 결과를 ëíë¸ë¤. + ì´ë <function>sprintf</function> ì <function>printf</function> ëëììë ë§ì°¬ê°ì§ì´ë¤. + </simpara> + <para> + ê°ê° ë³í í¹ì문ìë í¼ì¼í¸ 기í¸(<literal>%</literal>) ë¡ êµ¬ì±ëë©°, + ì°¨ë¡ ì°¨ë¡ë¡ ë¤ìì ììê° íë í¹ì ì¬ë¬ê° ë°ë¼ì¨ë¤ : + <orderedlist> + <listitem> + <simpara> + + ì íì ì¸ <emphasis>í¨ë© ì§ì ì(padding specifier)</emphasis>ë ê²°ê³¼ë¡ ë¬¸ìì´ ì¤ë¥¸ìª½ì ê·¸ ì í´ì§ + í¬ê¸°ë§í¼ í¨ë©ì ê°íëë° ì¬ì©ëë©°, ì´ë 공백 문ì ì¼ ìë ìê³ , <literal>0</literal>(0 문ì)ì¼ ì ë ìë¤. + 기본ì 공백ì¼ë¡ í¨ë©ëë©°, ë¤ë¥¸ í¨ë© 문ìê° ìì ë°ì´í (<literal>'</literal>)ì í¨ê» ìì ë¶ì´ ì§ì ëì´ ì§ + ìë ìë¤. + ìëì ì를 ë³´ë¼. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ <emphasis>ì ë ¬ ì§ì ì(alignment specifier)</emphasis>ë ê²°ê³¼ 문ìì´ì´ ì¼ìª½ ì ë ¬ë ê²ì¸ì§ + ì¤ë¥¸ìª½ ì ë ¬ ë ê²ì¸ì§ë¥¼ ê²°ì íë©°, 기본ì ì¤ë¥¸ìª½ ì ë ¬ì´ë¤; <literal>-</literal>문ìë ì¼ìª½ ì ë ¬ë¡ ë§ë ë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ ì«ì <emphasis>í ì§ì ì(width specifier)</emphasis>ë + (ìµì) ì¼ë§ë ë§ì 문ìë¤ì ì´ ë³íì´ ê²°ê³¼ë¡ ë¼ ê²ì¸ê°ë¥¼ ë§í´ì¤ë¤. + </simpara> + </listitem> + <listitem> + <simpara> + ì íì ì¸ <emphasis>ì ë°ë ì§ìì(precision specifier)</emphasis>ë + ì¼ë§ë ë§ì ìì§ ì«ìê° ììì ì´íì ìë¡ì íìë ê²ì¸ê°ë¥¼ ì§ì íë¤. + ì´ ìµì ì double íììë§ ì í¨íë¤.(ì«ì를 í¬ë©í íëë° ìì´ì ì ì©í + ë¤ë¥¸ í¨ìë¡ <function>number_format</function>ì´ ìë¤.) + </simpara> + </listitem> + <listitem> + <para> + <emphasis>í ì§ìì(type specifier)</emphasis>ë ì¸ì ë°ì´íê° ì ì©ë íìì ì§ì íë¤. + ê°ë¥í íì ì¼ë¡ë : + <simplelist> + <member> + <literal>%</literal> - 리í°ë´ í¼ì¼í¸ 문ì. ì´ë¤ ì¸ìë íìíì§ ìë¤. + </member> + <member> + <literal>b</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, ìì§ìë¡ ííëë¤. + </member> + <member> + <literal>c</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, ê·¸ ì«ìì ASCIIì½ëì í´ë¹íë 문ìë¡ ííëë¤. + </member> + <member> + <literal>d</literal> - ì¸ìë ì ìì²ë¼ ì²ë¦¬ëë©°, 10ì§ìë¡ ííëë¤. + </member> + <member> + <literal>f</literal> - ì¸ìë ëë¸íì¼ë¡ ì²ë¦¬ëë©°, ìì«ì ì ê°ì§ë ì¤ì ì«ìë¡ ííëë¤. + </member> + <member> + <literal>o</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, 8ì§ì ííë¡ ííëë¤. + </member> + <member> + <literal>s</literal> - ì¸ìë 문ìì´ë¡ ì²ë¦¬, ííëë¤. + </member> + <member> + <literal>x</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, (ì문ìë¡ íìëë)16ì§ìë¡ ííëë¤. + </member> + <member> + <literal>X</literal> - ì¸ìë ì ìë¡ ì²ë¦¬ëë©°, (ë문ìë¡ íìëë)16ì§ìë¡ ííëë¤. + </member> + </simplelist> + </para> + </listitem> + </orderedlist> + </para> + <simpara> + <function>printf</function>, <function>sscanf</function>, + <function>fscanf</function>, ê·¸ë¦¬ê³ <function>number_format</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + <refsect1> + <title>ì</title> + <para> + <example> + <title> + <function>Sprintf</function>: 0ì¼ë¡ ì±ìì§ ì ì</title> + <programlisting role="php"> +$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); + </programlisting> + </example> + <example> + <title> + <function>Sprintf</function>: íµíì í¬ë§·</title> + <programlisting role="php"> +$money1 = 68.75; +$money2 = 54.35; +$money = $money1 + $money2; +// echo $moneyë "123.1" ì ì¶ë ¥; +$formatted = sprintf ("%01.2f", $money); +// echo $formatted ë output "123.10"ì ì¶ë ¥ + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.strncasecmp"> + <refnamediv> + <refname>strncasecmp</refname> + <refpurpose> + ëì문ì를 ë¶íì§ ìë 2ì§ì ííì 문ìì´ì ì²ì n ê° ë¬¸ì를 ë¹êµ - + Binary safe case-insensitive string comparison of the first n characters + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strncasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>len</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strcasecmp</function>ì ë¹ì·íë©° ì°¨ì´ë¼ë©´, + ë¹êµì ì¬ì© ë ê°ê°ì 문ìì´ë¡ ë¶í° ë¹êµí 문ìì ì (<parameter>len</parameter>)를 + ì§ì í ì ìë¤ë ê²ì´ë¤. + ë ì¤ íëì 문ìì´ì´ (<parameter>len</parameter>ë³´ë¤ ì§§ë¤ë©´, ì§§ì 문ìì´ì 길ì´ê° + ë 문ìì´ì ë¹êµíë ë° ì¬ì©ëë¤. + </para> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + <function>ereg</function>, <function>strcasecmp</function>, + <function>strcmp</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strcasecmp"> + <refnamediv> + <refname>strcasecmp</refname> + <refpurpose> + ëì문ì를 구ë¶íì§ ìë 2ì§ì ííì 문ìì´ì ë¹êµ (Binary safe case-insensitive string comparison) + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + <example> + <title> + <function>strcasecmp</function> example</title> + <programlisting role="php"> +$var1 = "Hello"; +$var2 = "hello"; +if (!strcasecmp ($var1, $var2)) { + echo '$var1 is equal to $var2 in a case-insensitive string comparison'; +} + </programlisting> + </example> + </para> + <simpara> + <function>ereg</function>, <function>strcmp</function>, + <function>substr</function>, <function>stristr</function>, + <function>strncasecmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strchr"> + <refnamediv> + <refname>strchr</refname> + <refpurpose> + 문ìê° ì²ì ëíë ìì¹ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strchr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strstr</function>ì ë³ì¹ì´ë©°, 모ë ë°©ë©´ìì ëì¼íë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strcmp"> + <refnamediv> + <refname>strcmp</refname> + <refpurpose>2ì§ ííì 문ìì´ì ë¹êµ</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 ë¹êµí¨ì 주ìíë¼. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strncasecmp</function>, + <function>strncmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strcspn"> + <refnamediv> + <refname>strcspn</refname> + <refpurpose> + ë§ì¤í¬ì 매ì¹ëì§ ìë ì´ê¸° ì¸ê·¸ë¨¼í¸ì ê¸¸ì´ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strcspn</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str2</parameter> ë´ì ì´ë¤ 문ìë í¬í¨íì§ <emphasis>ìë</emphasis> + <parameter>str1</parameter>ì ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ë°ííë¤. + </simpara> + <simpara> + <function>strspn</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strip-tags"> + <refnamediv> + <refname>strip_tags</refname> + <refpurpose>문ìì´ë¡ ë¶í° HTML íê·¸ì PHP í그를 ìì¤ë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strip_tags</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>allowable_tags</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 모ë HTMLê³¼ PHP í그를 주ì´ì§ 문ìì´ë¡ ë¶í° ì ê±°íë¤. + ìì íì§ ëª»íê±°ë ë³´ê±°ì¤ íê·¸ ê°ì ê²½ì°ì ì´ë¬ë ë¸ë¤. + <function>fgetss</function> í¨ììì ì²ë¼ ê°íê·¸ ì ê±° state 머ì ì ì¬ì©íë¤. + </para> + <para> + ì íì ì¼ë¡ ëë²ì§¸ ì¸ì를 ì¬ì©íì¬ ì ê±°ëì§ ìì í그를 ì§ì í ìë ìë¤. + <note> + <para> + <parameter>Allowable_tags</parameter> ë PHP 3.0.13, PHP4B3 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + </refsect1> + </refentry> + <refentry id="function.stripcslashes"> + <refnamediv> + <refname>stripcslashes</refname> + <refpurpose> + <function>addcslashes</function>ë¡ quote ë 문ìì´ì un-quote íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stripcslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°±ì¬ëì¬ê° ì ê±°ë 문ìì´ì ë°ííë¤. + C íìì <literal>\n</literal>, <literal>\r</literal> ... 8ì§ì ê·¸ë¦¬ê³ 16ì§ì ííë ì¸ìíë¤. + <note> + <simpara> + PHP4b3-dev ìì ì¶ê°ëìë¤. + </simpara> + </note> + </para> + <simpara> + <function>addcslashes</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.stripslashes"> + <refnamediv> + <refname>stripslashes</refname> + <refpurpose> + <function>addslashes</function>ë¡ quote ë 문ìì´ì un-quote íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stripslashes</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë°±ì¬ëì¬ê° ì ê±°ë 문ìì´ì ë°ííë¤. + (<literal>\'</literal> ë <literal>'</literal> ë¡ ëë ë±.) + ì´ì¤ ë°±ì¬ëì¬ë íëì ë°±ì¬ëì¬ë¡ ë³íëë¤. + </para> + <simpara> + <function>addslashes</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.stristr"> + <refnamediv> + <refname>stristr</refname> + <refpurpose> + ëì문ì를 구ë³íì§ ìë <function>strstr</function> + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>stristr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>needle</parameter>ì ì²ì ë°ì ë¶í° ëë ë ê¹ì§ + 모ë <parameter>haystack</parameter>를 ë°ííë¤. + <parameter>needle</parameter> ê³¼ <parameter>haystack</parameter>ì + ëì문ì를 구ë³íì§ ìê³ ê²ì¬ëë¤. + </para> + <para> + ë§ì½<parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´ false 를 ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë©´, ì´ë ì«ìë¡ ë³íëê³ + 문ìì ììê°ì²ë¼ ì ì©ëë¤. + </para> + <para> + <function>strchr</function>, + <function>strrchr</function>, <function>substr</function>, ê·¸ë¦¬ê³ + <function>ereg</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strlen"> + <refnamediv> + <refname>strlen</refname> + <refpurpose>문ìì´ì 길ì´ë¥¼ 구íë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strlen</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>문ìì´ì 길ì´ë¥¼ ë°ííë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strnatcmp"> + <refnamediv> + <refname>strnatcmp</refname> + <refpurpose> + "natural order" ìê³ ë¦¬ì¦ì ì´ì©í 문ìì´ ë¹êµ + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strnatcmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ì¼ë¡ ì¬ëì´ íëê²ê³¼ ê°ì ìí벳과 ì«ì를 ì ë ¬íë ë°©ë²ì ë¹êµ ìê³ ë¦¬ì¦ì ìííë¤. + ì´ ìê³ ë¦¬ì¦ê³¼ ì»´í¨í°ê° ì¬ì©íë ì ë ¬ ìê³ ë¦¬ì¦(<function>strcmp</function>ì ì¬ì©)ê³¼ì ì°¨ì´ê° + ìëì ìì ëì ìë¤.: + <informalexample> + <programlisting> +$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); +echo "Standard string comparison\n"; +usort($arr1,"strcmp"); +print_r($arr1); +echo "\nNatural order string comparison\n"; +usort($arr2,"strnatcmp"); +print_r($arr2); + </programlisting> + </informalexample> + ìì ì½ëë ìëì 결과를 ìì±í ê²ì´ë¤.: + <informalexample> + <programlisting> +기본 문ìì´ ë¹êµ(Standard string comparison) +Array +( + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png +) + +Natural order 문ìì´ ë¹êµ +Array +( + [0] => img1.png + [1] => img2.png + [2] => img10.png + [3] => img12.png +) + </programlisting> + </informalexample> + ë ë§ì ì 보를 ìí´ Martin Pool ì <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> + ì ì°¸ê³ íë¼. + </para> + <simpara> + 문ìì´ ë¹êµ í¨ìì ë¹ì·íê² ì´ í¨ìë, + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 구ë³í¨ì ì ìí´ë¼. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcasecmp</function>, <function>strstr</function>, + <function>natsort</function> ê·¸ë¦¬ê³ <function>natcasesort</function>를 ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strnatcasecmp"> + <refnamediv> + <refname>strnatcasecmp</refname> + <refpurpose> + ëì문ì êµ¬ë³ ìì´ "natural order" ìê³ ë¦¬ì¦ì¼ë¡ 문ìì´ì ë¹êµíë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strnatcasecmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë ì¼ë¡ ì¬ëì´ íëê²ê³¼ ê°ì ìí벳과 ì«ì를 ì ë ¬íë ë°©ë²ì ë¹êµ ìê³ ë¦¬ì¦ì ìííë¤. + ì´ í¨ìì ìì©ì <function>strnatcmp</function> ì ë¹ì·íë©°, + ëì문ì를 구ë¶íì§ ìëë¤ë ë°ìì ì°¨ì´ê° ëë¤. + ë ë§ì ì 보를 ìí´ Martin Pool ì <ulink url="&url.strnatcmp;">Natural Order String Comparison</ulink> + ì ì°¸ê³ íë¼. + </para> + <simpara> + 문ìì´ ë¹êµ í¨ìì ë¹ì·íê² ì´ í¨ìë, + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + <function>ereg</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + <function>strncmp</function>, <function>strncasecmp</function>, + <function>strnatcmp</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strncmp"> + <refnamediv> + <refname>strncmp</refname> + <refpurpose> + ì²ì n 문ìì binary safe 문ìì´ ë¹êµ + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strncmp</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + <paramdef>int <parameter>len</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <function>strcmp</function>ë¹ ë¹ì·íë©°, + ë¹êµì ì¬ì© ë ê°ê°ì 문ìì´ë¡ ë¶í° ë¹êµí 문ìì ì (<parameter>len</parameter>)를 + ì§ì í ì ìë¤ë ê²ì ì°¨ì´ê° ìë¤. + ë ì¤ íëì 문ìì´ì´ (<parameter>len</parameter>ë³´ë¤ ì§§ë¤ë©´, ì§§ì 문ìì´ì 길ì´ê° + ë 문ìì´ì ë¹êµíë ë° ì¬ì©ëë¤. + </para> + <simpara> + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ ìë¤ë©´ < 0 ì ë°ííê³ ; + <parameter>str1</parameter>ì´ <parameter>str2</parameter>ë³´ë¤ í¬ë¤ë©´ > 0 ì ë°ííë¤. + ê·¸ë¦¬ê³ ì´ë¤ì´ ê°ë¤ë©´ 0ì ë°ííë¤. + </simpara> + <simpara> + ì´ ë¹êµë ëì문ì를 구ë¶íë¤ë ê²ì ì ìíë¼. + </simpara> + <simpara> + <function>ereg</function>, <function>strncasecmp</function>, + <function>strcasecmp</function>, <function>substr</function>, + <function>stristr</function>, <function>strcmp</function>, + ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.str-pad"> + <refnamediv> + <refname>str_pad</refname> + <refpurpose>ë¤ë¥¸ 문ìë¡ í¹ì 길ì´ë§í¼ 문ìì´ì ì±ì´ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_pad</function> + </funcdef> + <paramdef>string <parameter>input</parameter> + </paramdef> + <paramdef>int <parameter>pad_length</parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>pad_string</optional> + </parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>pad_type</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>input</parameter>문ìì´ì ì¼ìª½, ì¤ë¥¸ìª½, í¹ì ìë°©í¥ì¼ë¡ í¹ì í í¨ë© 길ì´ë§í¼ ì±ì´ë¤. + ë§ì½ ì íì ì¸ ë§¤ê°ë³ì <parameter>pad_string</parameter>ê° ì ê³µëì§ ìëë¤ë©´, + <parameter>input</parameter>ë 공백ì¼ë¡ ì±ìì§ë©°, ê·¸ë ì§ ìì ê²½ì° + ê·¸ íê³ê¹ì§ <parameter>pad_string</parameter>ë¡ ë¶í°ì 문ì를 ì±ì°ê² ëë¤. + </para> + <para> + ì íì ì¸ ë§¤ê°ë³ì <parameter>pad_type</parameter>ë¡ë + STR_PAD_RIGHT, STR_PAD_LEFT, í¹ì STR_PAD_BOTH ê° ì¬ ì ìë¤. + <parameter>pad_type</parameter>ê° ì§ì ëì§ ìì¼ë©´ STR_PAD_RIGHT ë¡ ì¬ê²¨ì§ë¤. + </para> + <para> + <parameter>pad_length</parameter>ì ê°ì´ ìì ê°ì´ê±°ë ì ë ¥ 문ìì´ì 길ì´ë³´ë¤ ìì ê²½ì° + í¨ë©ì ì¼ì´ëì§ ìëë¤. + </para> + <para> + <example> + <title> + <function>str_pad</function> ì</title> + <programlisting role="php"> +$input = "Alien"; +print str_pad($input, 10); // "Alien " ì´ ìì±ëë¤. +print str_pad($input, 10, "-=", STR_PAD_LEFT); // "-=-=-Alien" ì´ ìì±ëë¤. +print str_pad($input, 10, "_", STR_PAD_BOTH); // "__Alien___" ì´ ìì±ëë¤. + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.strpos"> + <refnamediv> + <refname>strpos</refname> + <refpurpose> + 문ìì´ìì ì²ì ìì¹ë¥¼ ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strpos</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>offset</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>haystack</parameter> 문ìì´ìì ì²ì ëíëë + <parameter>needle</parameter> ì ìì¹ë¥¼ ì«ìë¡ ë°ííë¤. + <function>strrpos</function>ì íë¦¬ê² ì´ í¨ìë + <parameter>needle</parameter> 매ê°ë³ì ë¡ ì ì²´ 문ìì´ì ì¬ì©í ì ìì¼ë©°, + Unlike the + <function>strrpos</function>, this function can take a full + string as the <parameter>needle</parameter> parameter and the + entire string will be used. + </para> + <para> + <parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´ ê±°ì§ì ë°ííë¤. + <note> + <para> + "0ë²ì§¸ ìì¹ìì ë°ê²¬ë 문ì"ì ëí ê°ê³¼ 문ìê° ë°ê²¬ëì§ ììì ê²½ì°ì ë°íëë ê°ì ëí´ + ì¤ì를 ë²í기 ì½ë¤. + ì¬ê¸° ì´ ì°¨ì´ì ì ê°ííë ë°©ë²ì´ ìë¤.: + <informalexample> + <programlisting role="php"> +// PHP 4.0b3 ì´ììì: +$pos = strpos ($mystring, "b"); +if ($pos === false) { // note: === ì ì¬ì© + // ë°ê²¬ëì§ ìì +} + +// PHP 4.0b3 ì´ì ì ë²ì ¼ìì: +$pos = strpos ($mystring, "b"); +if (is_string ($pos) && !$pos) { + // ë°ê²¬ëì§ ìì +} + </programlisting> + </informalexample> + </para> + </note> + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì´ë ì«ìë¡ ë³íëê³ ë¬¸ìì ìì´ ê°(ordinal value)ì¼ë¡ì ì ì©ëë¤. + </para> + <para> + ì íì ì¸ <parameter>offset</parameter> 매ê°ë³ìë + <parameter>haystack</parameter>ì ìë ì´ë¤ 문ìë¶í° 찾기 ììí ì§ë¥¼ ì§ì í ì ìê² í´ ì¤ë¤. + ë°íëë ìì¹ë <parameter>haystack</parameter> ì ììì¼ë¡ íë ìëì ì¸ ìì¹ê° ëë¤. + </para> + <para> + <function>strrpos</function>, + <function>strrchr</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strrchr"> + <refnamediv> + <refname>strrchr</refname> + <refpurpose> + 문ìì´ìì ê°ì¥ ë§ì§ë§ì ì´ì»¤ë°ì¤ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strrchr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>haystack</parameter>ì ì¼ë¶ë¥¼ ë°ííëë°, + ì´ë <parameter>needle</parameter>ì ë§ì§ë§ ì´ì»¤ë°ì¤ìì ììíê³ + <parameter>haystack</parameter>ì ëê¹ì§ ì§íëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + </para> + <para> + <parameter>needle</parameter>ì´ í문ì ì´ìì í¬í¨íê³ ìì¼ë©´, + 첫ë²ì§¸ 문ìê° ì¬ì©ëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì«ìë¡ ë³íëì´ ë¬¸ìì ìì´ê°(ordinal value) ë¡ì ì ì©ëë¤. + <example> + <title> + <function>Strrchr</function> ì</title> + <programlisting role="php"> +// $PATH ììì ë§ì§ë§ ëë í 리를 ì»ëë¤. +$dir = substr (strrchr ($PATH, ":"), 1); + +// ë§ì§ë§ ë´ë¼ì¸ ë¤ìì 문ìì´ì ì»ëë¤. +$text = "Line 1\nLine 2\nLine 3"; +$last = substr (strrchr ($text, 10), 1 ); + </programlisting> + </example> + </para> + <para> + <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.str-repeat"> + <refnamediv> + <refname>str_repeat</refname> + <refpurpose>문ìì´ì ë°ë³µíë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_repeat</function> + </funcdef> + <paramdef>string <parameter>input</parameter> + </paramdef> + <paramdef>int <parameter>multiplier</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>input_str</parameter>ì <parameter>multiplier</parameter>ë² ë°ë³µí´ì ë°ííë¤. + <parameter>multiplier</parameter>ë ë°ëì 0ë³´ë¤ ì»¤ì¼ íë¤. + </para> + <example> + <title> + <function>Str_repeat</function> ì</title> + <programlisting role="php"> +echo str_repeat ("-=", 10); + </programlisting> + </example> + <para> + This will output "-=-=-=-=-=-=-=-=-=-=". + </para> + <note> + <para> + ì´ í¨ìë PHP 4.0 ìì ì¶ê°ëìë¤. + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.strrev"> + <refnamediv> + <refname>strrev</refname> + <refpurpose>문ìì´ì ë¤ì§ëë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strrev</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ìì¼ë¡ ë <parameter>string</parameter>ì ë°ííë¤. + </para> + </refsect1> + </refentry> + <refentry id="function.strrpos"> + <refnamediv> + <refname>strrpos</refname> + <refpurpose> + 문ìì´ ììì 문ìì ë§ì§ë§ ì¶í ìì¹ë¥¼ ë°ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strrpos</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>char <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>haystack</parameter>문ìì´ìì + <parameter>needle</parameter>ì ë§ì§ë§ ì¶í ìì¹ë¥¼ + ì«ìë¡ ë°ííë¤. + ì´ ê²½ì°ì needleì ë¨ì§ ë¨ì¼ 문ìë§ ê°ë¥íë¤ë ê²ì ëª ì¬íë¼. + ë§ì½ 문ìì´ì´ needleë¡ì ì ë¬ëë¤ë©´, ì¤ì§ ê·¸ 문ìì´ì 첫ë²ì§¸ 문ìë§ì´ ì¬ì©ëë¤. + </para> + <para> + <parameter>needle</parameter>ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + <note> + <para> + ì¼ì´ë기 ì¬ì´ ì¤ì ì¤ì íëë "ìì¹ 0ì´ì 문ìê° ë°ê²¬"ë ê²½ì° ì + "문ìê° ë°ê²¬ëì§ ìì ê²½ì°"ì ëí ë°íê°ì´ë¤. + ì¬ê¸° ì´ ì°¨ì´ë¥¼ ë°ê²¬íë ë°©ë²ì´ ìë¤.: + <informalexample> + <programlisting role="php"> +// PHP 4.0b3 ì´ììì: +$pos = strrpos ($mystring, "b"); +if ($pos === false) { // note: === ì¬ì© + // ë°ê²¬ëì§ ìì +} + +// ë²ì ¼ 4.0b3 ì´íìì: +$pos = strrpos ($mystring, "b"); +if (is_string ($pos) && !$pos) { + // ë°ê²¬ëì§ ìì +} + </programlisting> + </informalexample> + </para> + </note> + </para> + <para> + <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë¼ë©´, + ì«ìë¡ ë³íëì´ ë¬¸ìì ìì´ê°(ordinal value) ë¡ì ì ì©ëë¤. + </para> + <para> + <function>strpos</function>, + <function>strrchr</function>, <function>substr</function>, + <function>stristr</function>, ê·¸ë¦¬ê³ <function>strstr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strspn"> + <refnamediv> + <refname>strspn</refname> + <refpurpose> + ë§ì¤í¬ì 매ì¹ëë ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ì°¾ëë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>strspn</function> + </funcdef> + <paramdef>string <parameter>str1</parameter> + </paramdef> + <paramdef>string <parameter>str2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <parameter>str2</parameter> ë´ì ì´ë¤ 문ìë í¬í¨íë + <parameter>str1</parameter>ì ì´ê¸° ì¸ê·¸ë¨¼í¸ì 길ì´ë¥¼ ë°ííë¤. + </simpara> + <para> + <informalexample> + <programlisting role="php"> +strspn ("42 is the answer, what is the question ...", "1234567890"); + </programlisting> + <para> + ì ê²°ê³¼ë¡ 2를 ë°ííë¤. + </para> + </informalexample> + </para> + <simpara> + <function>strcspn</function>ì ì°¸ê³ íë¼. + </simpara> + </refsect1> + </refentry> + <refentry id="function.strstr"> + <refnamediv> + <refname>strstr</refname> + <refpurpose>문ìì´ì ì²ì ì´ì»¤ë°ì¤ë¥¼ ì°¾ëë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strstr</function> + </funcdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>needle</parameter>ì ì²ì ì´ì»¤ë°ì¤ë¶í° ëê¹ì§ì + <parameter>haystack</parameter> ì ë¶ë¥¼ ë°ííë¤. + </para> + <para> + <parameter>needle</parameter> ì´ ë°ê²¬ëì§ ìì¼ë©´, ê±°ì§ì ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>needle</parameter>ì´ ë¬¸ìì´ì´ ìëë©´, ì´ë ì«ìë¡ ë³íëê³ + 문ìì ììê°ì²ë¼ ì ì©ëë¤. + </para> + <para> + <note> + <para> + ì´ í¨ìë ëì문ì를 구ë¶íë©°, ëì문ìì 구ë¶ì´ í ì ìì ë + <function>stristr</function>ì ì¬ì©íë¼. + </para> + </note> + </para> + <para> + <example> + <title> + <function>Strstr</function> ì</title> + <programlisting role="php"> +$email = 'sterling@designmultimedia.com'; +$domain = strstr ($email, '@'); +print $domain; // prints @designmultimedia.com + </programlisting> + </example> + </para> + <para> + <function>stristr</function>, + <function>strrchr</function>, <function>substr</function>, ê·¸ë¦¬ê³ + <function>ereg</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.strtok"> + <refnamediv> + <refname>strtok</refname> + <refpurpose>문ìì´ì í í°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtok</function> + </funcdef> + <paramdef>string <parameter>arg1</parameter> + </paramdef> + <paramdef>string <parameter>arg2</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>strtok</function>ì 문ìì´ì í í°í íëë° ì¬ì©ëë¤. + ì¦, "This is an example string"ì ê°ì 문ìì´ì´ ìì¼ë©´, + í í°ì¼ë¡ 공백 문ì를 ì¬ì©íì¬ ì´ ë¬¸ìì´ì ê°ê°ì ë¨ì´ë¥¼ í í°í í ì ìë¤. + <example> + <title> + <function>Strtok</function> ì</title> + <programlisting role="php"> +$string = "This is an example string"; +$tok = strtok ($string," "); +while ($tok) { + echo "Word=$tok<br>"; + $tok = strtok (" "); +} + </programlisting> + </example> + </para> + <para> + ì¤ë¡ì§ ì²ì ë¶ë¦¬ìì§ strtok ì´ ë¬¸ìì´ ì¸ì를 ì¬ì©íë¤. + ë¤ì ëì¤ë ê°ê°ì strtok í¸ì¶ì ì¬ì©í¨ì ìì´ í í°ë§ì´ íìíë©° + ì´ë íì¬ì 문ìì´ í¸ëì ì ì§í기 ë문ì´ë¤. + ë¤ì ììíê±°ë ìë¡ì´ 문ìì´ì í í°í íê³ ì íë¤ë©´, + ì´ë¥¼ ì´ê¸°í í기 ìí´ ë¨ìí 문ìì´ ì¸ìì í¨ê» strtok 를 í¸ì¶íë©´ ëë¤. + ë¤ìì í í°ì í í° ë§¤ê°ë³ìì ë£ì ìë ìì¼ë©°, + 문ìì´ì 매ê°ë³ìì ìë 문ì ì¤ ìë¬´ê² íë를 ë§ëë©´, í í°í ëë¤. + </para> + <para> + ìì±ë í í°ì "0" ì´ ë ìë ììì ì ìíë¼. + ì´ë ì¡°ê±´ììì ê±°ì§ì ëíë´ë ê°ì´ê¸°ë íë¤. + </para> + <para> + <function>split</function> ê·¸ë¦¬ê³ + <function>explode</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtolower"> + <refnamediv> + <refname>strtolower</refname> + <refpurpose>문ìì´ì ì문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtolower</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 모ë ìíë²³ì ì문ìë¡ ë³íí 문ìì´ì ë°ííë¤. + </para> + <para> + 'ìíë²³'ì´ë¼ í¨ì íì¬ ë¡ì¼ì¼ì ì í´ ì í´ì§ë¤. ì´ë ì¦ ê¸°ë³¸ì ì¼ë¡ "C" ë¡ì¼ì¼ìì + umlaut-A (© ê°ì 문ìë ë°ëì§ ììì ì미íë¤. + </para> + <example> + <title> + <function>Strtolower</function> ì</title> + <programlisting role="php"> +$str = "Mary Had A Little Lamb and She LOVED It So"; +$str = strtolower($str); +print $str; # mary had a little lamb and she loved it so 를 ì¶ë ¥íë¤. + </programlisting> + </example> + <para> + <function>strtoupper</function> + ê·¸ë¦¬ê³ <function>ucfirst</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtoupper"> + <refnamediv> + <refname>strtoupper</refname> + <refpurpose>문ìì´ì ë문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtoupper</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>string</parameter>ì 모ë ìíë²³ì ë문ìë¡ ë³íí 문ìì´ì ë°ííë¤. + </para> + <para> + 'ìíë²³'ì´ë¼ í¨ì íì¬ ë¡ì¼ì¼ì ì í´ ì í´ì§ë¤. ì´ë ì¦ ê¸°ë³¸ì ì¼ë¡ "C" ë¡ì¼ì¼ìì + umlaut-a(â§ ê°ì 문ìë ë°ëì§ ììì ì미íë¤. + </para> + <example> + <title> + <function>Strtoupper</function> ì</title> + <programlisting role="php"> +$str = "Mary Had A Little Lamb and She LOVED It So"; +$str = strtoupper ($str); +print $str; # MARY HAD A LITTLE LAMB AND SHE LOVED IT SO ì ì¶ë ¥íë¤. + </programlisting> + </example> + <para> + <function>strtolower</function> + ê·¸ë¦¬ê³ <function>ucfirst</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.str-replace"> + <refnamediv> + <refname>str_replace</refname> + <refpurpose> + haystack ì 모ë needleì strë¡ ë³ííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>str_replace</function> + </funcdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>haystack</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>haystack</parameter>ì <parameter>needle</parameter>ì + 주ì´ì§ <parameter>str</parameter>ë¡ ë°ê¾¼ë¤. + (This function replaces all occurences of <parameter>needle</parameter> in <parameter>haystack</parameter> + with the given <parameter>str</parameter>.) + ë§ì½ ë³µì¡í ì¹í ë£°ì´ íìíì§ ìë¤ë©´, <function>ereg_replace</function> ëì + ì´ í¨ì를 ì¬ì©íì¬ë ëë¤. + </para> + <para> + <example> + <title> + <function>Str_replace</function> ì</title> + <programlisting role="php"> +$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); + </programlisting> + </example> + </para> + <para> + ì´ í¨ìë binary safe. + </para> + <note> + <para> + <function>Str_replace</function>ë PHP 3.0.6,ìì ì¶ê°ëìì§ë§, + PHP 3.0.8 ì ë²ê·¸ê° ìì ëìë¤. + </para> + </note> + <para> + <function>ereg_replace</function> ê·¸ë¦¬ê³ + <function>strtr</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.strtr"> + <refnamediv> + <refname>strtr</refname> + <refpurpose>í¹ì 문ì를 ë²ìíë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>strtr</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>string <parameter>from</parameter> + </paramdef> + <paramdef>string <parameter>to</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë <parameter>str</parameter>ì ëí´ <parameter>from</parameter>ì íí¨ëë ê°ê°ì 문ì를 + <parameter>to</parameter>ì ìë ëìëë 문ìë¡ ë²ìíê³ ê·¸ 결과를 ë°ííë¤. + </para> + <para> + <parameter>from</parameter>ê³¼ <parameter>to</parameter>ê° + ë¤ë¥¸ 길ì´ì¼ ë ë ì¤ ê¸´ 문ìì´ì ëë¨¸ì§ ë¬¸ìë¤ì 무ìëë¤. + <example> + <title> + <function>Strtr</function> ì</title> + <programlisting role="php"> +$addr = strtr($addr, "妶", "aao"); + </programlisting> + </example> + </para> + <para> + <function>strtr</function>ì ë¨ì§ ëê°ì ì¸ì를 ê°ì§ ì ë ìë¤. + ë§ì½ ëê°ì ì¸ìë§ ê°ì§ê³ í¸ì¶ëë¤ë©´ ìë¡ì´ ë°©ìì¼ë¡ ëìíë¤.: + ì´ë <parameter>from</parameter>ì ìì¤ìì ë³í ë + 문ìì´ -> 문ìì´ ìì ê°ë ë°°ì´ì´ì´ì¼ íë¤. + <function>strtr</function>ì íì ì²ìì ê°ì¥ 긴 ë²ì ê°ë¥í 매ì¹ë¥¼ ì°¾ê³ + ê·¸ í ì´ë¯¸ ë²ìë ê²ì ë¤ì ì¹ííë ¤ê³ íì§ ìì ê²ì´ë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$trans = array ("hello" => "hi", "hi" => "hello"); +echo strtr("hi all, I said hello", $trans) . "\n"; + </programlisting> + </informalexample> + This will show: "hello all, I said hi", + </para> + <note> + <simpara> + ë ì¸ì를 ì´ì©íë ë°©ë²ì PHP 4.0 ìì ì¶ê°ëìë¤. + </simpara> + </note> + <para> + <function>ereg_replace</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.substr"> + <refnamediv> + <refname>substr</refname> + <refpurpose>문ìì´ì ì¼ë¶ë¥¼ ë°ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>substr</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>int <parameter>start</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>length</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + Substrì <parameter>start</parameter>ì <parameter>length</parameter> + 매ê°ë³ìì ìí´ ì§ì ë <parameter>string</parameter> 문ìì´ì ì¼ë¶ë¥¼ ë°ííë¤. + </para> + <para> + ë§ì½ <parameter>start</parameter>ììë¼ë©´, ë°íëë 문ìì´ì + 0ë¶í° ììëë <parameter>string</parameter>ì <parameter>start</parameter>ë²ì§¸ ìì¹ìì + ììíë 문ìì´ì´ ë ê²ì´ë¤. + ì를 ë¤ì´ 문ìì´ '<literal>abcdef</literal>'ì´ ìë¤ê³ íì. + <literal>0</literal>ì ìì¹ì ìë 문ìë '<literal>a</literal>'ê° ëê³ , + <literal>2</literal>ì ìì¹ì ìë 문ìë '<literal>c</literal>'ê° ëë ìì´ë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", 1); // "bcdef" ì ë°ííë¤. +$rest = substr ("abcdef", 1, 3); // "bcd" ì ë°ííë¤. + </programlisting> + </informalexample> + </para> + <para> + ë§ì½ <parameter>start</parameter>ê° ììë¼ë©´, + ë°íëë 문ìì´ì <parameter>string</parameter>ì ëììë¶í° + <parameter>start</parameter>ë²ì§¸ ë¶í° ììíë 문ìì´ì´ ëë¤. + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", -1); // "f" 를 ë°í +$rest = substr ("abcdef", -2); // "ef" 를 ë°í +$rest = substr ("abcdef", -3, 1); // "d" 를 ë°í + </programlisting> + </informalexample> + </para> + <para> + ë§ì½ <parameter>length</parameter>ì´ ì£¼ì´ì§ê³ ìì ê°ì´ë¼ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ìì ììí´ì + <parameter>length</parameter>ìì ëëë 문ìì´ì´ ë ê²ì´ë¤. + ë§ì½ (ììì´ ë¬¸ìì´ì ëì ì§ë기 ë문ì) 문ìì´ì´ ìì 길ì´ë¥¼ ê°ë ê²°ê³¼ê° ëë¤ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ì 문ì íëê° ë ê²ì´ë¤. + (ìì주: ë¹ë¬¸ìì´ì´ ì¶ë ¥ëë¤.) + </para> + <para> + ë§ì½ <parameter>length</parameter>ì´ ìì ê°ì´ë¼ë©´, + ì¤í¸ë§ì ëìì ë¶í° ììí´ì <parameter>length</parameter>ì + ìì¹ì ìë 문ìê° ë°íëë 문ìì´ì ëì´ ëë 문ìì´ì´ ëë¤. + ë§ì½ 문ìì´ì´ ìì 길ì´ë¥¼ ê°ë ê²°ê³¼ê° ëì¨ë¤ë©´, + ë°íëë 문ìì´ì <parameter>start</parameter>ì 문ì íëê° ë ê²ì´ë¤. + (ìì주: ë¹ë¬¸ìì´ì´ ì¶ë ¥ëë¤.) + </para> + <para> + ì: + <informalexample> + <programlisting role="php"> +$rest = substr ("abcdef", 1, -1); // "bcde"를 ë°ííë¤. + </programlisting> + </informalexample> + </para> + <para> + <function>strrchr</function> ê·¸ë¦¬ê³ + <function>ereg</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.substr-count"> + <refnamediv> + <refname>substr_count</refname> + <refpurpose>ë¶ë¶ë¬¸ìì´ì ì를 ì¼ë¤</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>substr_count</function> + </funcdef> + <paramdef>string <parameter>haystrack</parameter> + </paramdef> + <paramdef>string <parameter>needle</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>substr_count</function>ì <parameter>haystack</parameter> 문ìì´ì + ìë <parameter>needle</parameter> ë¶ë¶ 문ìì´ì ì를 ë°ííë¤. + </para> + <para> + <example> + <title> + <function>substr_count</function> ì</title> + <programlisting> +print substr_count("This is a test", "is"); // 2를 ì¶ë ¥íë¤. + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.substr-replace"> + <refnamediv> + <refname>substr_replace</refname> + <refpurpose>문ìì´ì ì¼ë¶ë¥¼ ì¹ííë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>substr_replace</function> + </funcdef> + <paramdef>string <parameter>string</parameter> + </paramdef> + <paramdef>string <parameter>replacement</parameter> + </paramdef> + <paramdef>int <parameter>start</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>length</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>substr_replace</function> ë <parameter>string</parameter>ì + <parameter>start</parameter> ì (ì íì ì¼ë¡) <parameter>length</parameter>ë¡ + ì í´ì§ 구ê°ì í´ë¹íë ë¶ë¶ì <parameter>replacement</parameter>ë¡ ì¹ííê³ + ê·¸ 결과를 ë°ííë¤. + </para> + <para> + <parameter>start</parameter>ê° ììë¼ë©´ <parameter>string</parameter>ì + <parameter>start</parameter>ë²ì§¸ ì¹íì´ ì¼ì´ëë¤. + </para> + <para> + <parameter>start</parameter>ê° ììë¼ë©´, <parameter>string</parameter>ì ëìì ë¶í° + <parameter>start</parameter>ë²ì§¸ 문ìê¹ì§ì 문ìì´ì ì¹ííë¤. + </para> + <para> + <parameter>length</parameter>ì´ ììë¼ë©´, ì´ë ì¹í ë + <parameter>string</parameter>ì ì¼ë¶ë¶ì 길ì´ë¥¼ ëíë¸ë¤. + ë§ì½ ììë¼ë©´, <parameter>string</parameter>ì ëìì ë¶í°ì + 문ìì ì를 ëíë¸ë¤. + ë§ì½ 주ì´ì§ì§ ìëë¤ë©´ 기본 ê°ì¼ë¡ strlen(<parameter>string</parameter>) + ì¦, <parameter>string</parameter>ì ëìì ì¹íì´ ëë¨ì ì미íë¤. + </para> + <para> + <example> + <title> + <function>Substr_replace</function> ì</title> + <programlisting role="php"> +<?php +$var = 'ABCDEFGH:/MNRPQR/'; +echo "Original: $var<hr>\n"; + +/* ë¤ì ëê°ì§ ìë $varì 모ë 문ìì´ì 'bob'ì¼ë¡ ì¹ííë¤. */ +echo substr_replace ($var, 'bob', 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; + +/* $varì 첫ë¶ë¶ì 'bob' ì ì½ì íë¤. */ +echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; + +/* ë¤ì ë ìë $var ë´ì 'MNRPQR' ì 'bob'ì¼ë¡ ì¹ííë¤. */ +echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; + +/* $varë¡ ë¶í°'MNRPQR' ì ì§ì´ë¤. */ +echo substr_replace ($var, '', 10, -1) . "<br>\n"; +?> + </programlisting> + </example> + </para> + <para> + <function>str_replace</function> ê·¸ë¦¬ê³ + <function>substr</function>ì ì°¸ê³ íë¼. + </para> + <note> + <simpara> + <function>Substr_replace</function> ë PHP 4.0ìì ì¶ê°ëìë¤. + </simpara> + </note> + </refsect1> + </refentry> + <refentry id="function.trim"> + <refnamediv> + <refname>trim</refname> + <refpurpose> + 문ìì´ì ì²ìê³¼ ëì ìë 공백ì ì ê±°íë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>trim</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ì´ í¨ìë 문ìì´ì ì²ìê³¼ ëì ìë 공백문ì를 ì ê±°íê³ ì´ ë¬¸ìì´ì ë°ííë¤. + 공백문ìë¼ í¨ì "\n", "\r", "\t", "\v", "\0", ê·¸ë¦¬ê³ ê³µë°±ì ë§íë¤. + </para> + <para> + <function>chop</function>, <function>rtrim</function> ê·¸ë¦¬ê³ + <function>ltrim</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ucfirst"> + <refnamediv> + <refname>ucfirst</refname> + <refpurpose>문ìì´ì ì²ì ê¸ì를 ë문ìë¡ ë§ë ë¤.</refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ucfirst</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + ë§ì½ 문ìì´ <parameter>str</parameter>ì ì²ì 문ìê° ìíë²³ì´ë¼ë©´, ê·¸ ì²ì ê¸ì를 ë문ìë¡ ë§ë ë¤. + </para> + <para> + 'ìíë²³'ì íì¬ ë¡ì¼ì¼ì ìí´ ì ìëë¤. + ì를ë¤ë©´ ë¡ì¼ì¼ ëí´í¸ê° "C" ë¡ì¼ì¼ë¡ ëì´ ìì ê²½ì° + umlaut-a(â§ ê°ì 문ìë ë°ëì§ ìëë¤. + <example> + <title> + <function>Ucfirst</function> ì</title> + <programlisting role="php"> +$text = 'mary had a little lamb and she loved it so.'; +$text = ucfirst ($text); // $text ë Mary had a little lamb + // and she loved it so. ë¡ ë°ëë¤. + </programlisting> + </example> + </para> + <para> + <function>strtoupper</function> ê·¸ë¦¬ê³ + <function>strtolower</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.ucwords"> + <refnamediv> + <refname>ucwords</refname> + <refpurpose> + 문ìì´ì ìë ê° ë¨ì´ì ì²ì ê¸ì를 ë문ìë¡ ë°ê¾¼ë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>ucwords</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>ì ê°ê°ì ë¨ì´ì 첫문ìê° ìíë²³ì´ë¼ë©´ + ê·¸ ê¸ì를 ë문ìë¡ ë°ê¾¼ë¤. + <example> + <title> + <function>ucwords</function> ì</title> + <programlisting role="php"> +$text = "mary had a little lamb and she loved it so."; +$text = ucwords($text); // $text ë : Mary Had A Little + // Lamb And She Loved It So. ì´ ëë¤. + </programlisting> + </example> + <note> + <simpara> + ë¨ì´ì ì ìë ë¤ì íì´í¸ì¤íì´ì¤ê° ì¬ ë ê¹ì§ì 문ì를 ë§íë¤. + (íì´í¸ì¤íì´ì¤ë 공백, í¼í¼ë, ëë¼ì¸, ì¼ë¦¬ì§ë¦¬í´, ìì§í, ìíí ì ì¼ì»«ëë¤.) + </simpara> + </note> + </para> + <para> + <function>strtoupper</function>, + <function>strtolower</function> ê·¸ë¦¬ê³ <function>ucfirst</function>ì ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> + <refentry id="function.wordwrap"> + <refnamediv> + <refname>wordwrap</refname> + <refpurpose> + ì ì§ë¬¸ì를 ì´ì©í´ 주ì´ì§ ì ë§í¼ì 문ì를 ëííë¤. + </refpurpose> + </refnamediv> + <refsect1> + <title>ì¤ëª </title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>wordwrap</function> + </funcdef> + <paramdef>string <parameter>str</parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>width</optional> + </parameter> + </paramdef> + <paramdef>string + <parameter> + <optional>break</optional> + </parameter> + </paramdef> + <paramdef>int + <parameter> + <optional>cut</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>str</parameter>문ìì´ì <parameter>width</parameter> + 매ê°ë³ìì ì§ì ë 길ì´ë§í¼(ì íì ) ë©ííë¤. + ì¤ì <parameter>break</parameter> 매ê°ë³ì(ì íì )ì ìí´ ë¶ë¦¬ëë¤. + </para> + <para> + <function>wordwrap</function>ì ìëì ì¼ë¡ 75컬ë¼ìì ë©ì íë©°, ë¸ë ì´í¬ë¡ë '\n'(ë´ë¼ì¸)ì ì¬ì©íë¤. + </para> + <para> + <parameter>cut</parameter>ì´ 1ë¡ ì§ì ëë©´, 문ìì´ì íì ì§ì ë 길ì´ë¡ ë©íëë©°, 주ì´ì§ ëì´ë³´ë¤ ë 긴 ë¨ì´ê° ìë¤ë©´, + ê·¸ ë¨ì´ë ëëì´ ì§ë¤.(ëë²ì§¸ ìì 를 ë³´ë¼) + (See second example). + <note> + <para> + <parameter>cut</parameter> 매ê°ë³ìë PHP 4.0.3 ìì ì¶ê°ëìë¤. + </para> + </note> + </para> + <para> + <example> + <title> + <function>wordwrap</function> ì</title> + <programlisting role="php"> +$text = "The quick brown fox jumped over the lazy dog."; +$newtext = wordwrap( $text, 20 ); + +echo "$newtext\n"; + </programlisting> + </example> + </para> + <para> + ì´ ìë ë¤ìì ì¶ë ¥íë¤.: + </para> + <para> + <informalexample> + <programlisting> +The quick brown fox +jumped over the lazy dog. + </programlisting> + </informalexample> + </para> + <para> + <example> + <title> + <function>wordwrap</function> ì</title> + <programlisting role="php"> +$text = "A very long woooooooooooord."; +$newtext = wordwrap( $text, 8, "\n", 1); + +echo "$newtext\n"; + </programlisting> + </example> + </para> + <para> + ì´ ìë ë¤ìì ì¶ë ¥íë¤.: + </para> + <para> + <informalexample> + <programlisting> +A very +long +wooooooo +ooooord. + </programlisting> + </informalexample> + </para> + <para> + <function>nl2br</function>를 ì°¸ê³ íë¼. + </para> + </refsect1> + </refentry> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +-->