<HTML ><HEAD ><TITLE >String functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="stream_set_write_buffer" HREF="function.stream-set-write-buffer.html"><LINK REL="NEXT" TITLE="addcslashes" HREF="function.addcslashes.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.stream-set-write-buffer.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.addcslashes.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.strings" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XCIX. String functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN88976" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.intro" ></A >Introduction</H1 ><P > These functions all manipulate strings in various ways. Some more specialized sections can be found in the regular expression and <A HREF="ref.url.html" >URL handling</A > sections. </P ><P > For information on how strings behave, especially with regard to usage of single quotes, double quotes, and escape sequences, see the <A HREF="language.types.string.html" >Strings</A > entry in the <A HREF="language.types.html" >Types</A > section of the manual. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.requirements" ></A >Requirements</H1 ><P >No external libraries are needed to build this extension.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.installation" ></A >Installation</H1 ><P >There is no installation needed to use these functions; they are part of the PHP core.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.constants" ></A >Predefined Constants</H1 ><P >This extension has no constants defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.seealso" ></A >See Also</H1 ><P > For even more powerful string handling and manipulating functions take a look at the <A HREF="ref.regex.html" >POSIX regular expression functions</A > and the <A HREF="ref.pcre.html" >Perl compatible regular expression functions</A >. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.addcslashes.html" >addcslashes</A > -- Quote string with slashes in a C style</DT ><DT ><A HREF="function.addslashes.html" >addslashes</A > -- Quote string with slashes</DT ><DT ><A HREF="function.bin2hex.html" >bin2hex</A > -- Convert binary data into hexadecimal representation </DT ><DT ><A HREF="function.chop.html" >chop</A > -- Alias of <A HREF="function.rtrim.html" ><B CLASS="function" >rtrim()</B ></A ></DT ><DT ><A HREF="function.chr.html" >chr</A > -- Return a specific character</DT ><DT ><A HREF="function.chunk-split.html" >chunk_split</A > -- Split a string into smaller chunks</DT ><DT ><A HREF="function.convert-cyr-string.html" >convert_cyr_string</A > -- Convert from one Cyrillic character set to another </DT ><DT ><A HREF="function.count-chars.html" >count_chars</A > -- Return information about characters used in a string </DT ><DT ><A HREF="function.crc32.html" >crc32</A > -- Calculates the crc32 polynomial of a string</DT ><DT ><A HREF="function.crypt.html" >crypt</A > -- One-way string encryption (hashing)</DT ><DT ><A HREF="function.echo.html" >echo</A > -- Output one or more strings</DT ><DT ><A HREF="function.explode.html" >explode</A > -- Split a string by string</DT ><DT ><A HREF="function.fprintf.html" >fprintf</A > -- Write a formatted string to a stream</DT ><DT ><A HREF="function.get-html-translation-table.html" >get_html_translation_table</A > -- Returns the translation table used by <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A > and <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A > </DT ><DT ><A HREF="function.hebrev.html" >hebrev</A > -- Convert logical Hebrew text to visual text </DT ><DT ><A HREF="function.hebrevc.html" >hebrevc</A > -- Convert logical Hebrew text to visual text with newline conversion </DT ><DT ><A HREF="function.html-entity-decode.html" >html_entity_decode</A > -- Convert all HTML entities to their applicable characters </DT ><DT ><A HREF="function.htmlentities.html" >htmlentities</A > -- Convert all applicable characters to HTML entities </DT ><DT ><A HREF="function.htmlspecialchars.html" >htmlspecialchars</A > -- Convert special characters to HTML entities </DT ><DT ><A HREF="function.implode.html" >implode</A > -- Join array elements with a string</DT ><DT ><A HREF="function.join.html" >join</A > -- Join array elements with a string</DT ><DT ><A HREF="function.levenshtein.html" >levenshtein</A > -- Calculate Levenshtein distance between two strings </DT ><DT ><A HREF="function.localeconv.html" >localeconv</A > -- Get numeric formatting information</DT ><DT ><A HREF="function.ltrim.html" >ltrim</A > -- Strip whitespace from the beginning of a string </DT ><DT ><A HREF="function.md5-file.html" >md5_file</A > -- Calculates the md5 hash of a given filename</DT ><DT ><A HREF="function.md5.html" >md5</A > -- Calculate the md5 hash of a string</DT ><DT ><A HREF="function.metaphone.html" >metaphone</A > -- Calculate the metaphone key of a string</DT ><DT ><A HREF="function.money-format.html" >money_format</A > -- Formats a number as a currency string</DT ><DT ><A HREF="function.nl-langinfo.html" >nl_langinfo</A > -- Query language and locale information </DT ><DT ><A HREF="function.nl2br.html" >nl2br</A > -- Inserts HTML line breaks before all newlines in a string </DT ><DT ><A HREF="function.number-format.html" >number_format</A > -- Format a number with grouped thousands</DT ><DT ><A HREF="function.ord.html" >ord</A > -- Return ASCII value of character</DT ><DT ><A HREF="function.parse-str.html" >parse_str</A > -- Parses the string into variables</DT ><DT ><A HREF="function.print.html" >print</A > -- Output a string</DT ><DT ><A HREF="function.printf.html" >printf</A > -- Output a formatted string</DT ><DT ><A HREF="function.quoted-printable-decode.html" >quoted_printable_decode</A > -- Convert a quoted-printable string to an 8 bit string </DT ><DT ><A HREF="function.quotemeta.html" >quotemeta</A > -- Quote meta characters</DT ><DT ><A HREF="function.rtrim.html" >rtrim</A > -- Strip whitespace from the end of a string </DT ><DT ><A HREF="function.setlocale.html" >setlocale</A > -- Set locale information</DT ><DT ><A HREF="function.sha1-file.html" >sha1_file</A > -- Calculate the sha1 hash of a file</DT ><DT ><A HREF="function.sha1.html" >sha1</A > -- Calculate the sha1 hash of a string</DT ><DT ><A HREF="function.similar-text.html" >similar_text</A > -- Calculate the similarity between two strings </DT ><DT ><A HREF="function.soundex.html" >soundex</A > -- Calculate the soundex key of a string</DT ><DT ><A HREF="function.sprintf.html" >sprintf</A > -- Return a formatted string</DT ><DT ><A HREF="function.sscanf.html" >sscanf</A > -- Parses input from a string according to a format </DT ><DT ><A HREF="function.str-pad.html" >str_pad</A > -- Pad a string to a certain length with another string </DT ><DT ><A HREF="function.str-repeat.html" >str_repeat</A > -- Repeat a string</DT ><DT ><A HREF="function.str-replace.html" >str_replace</A > -- Replace all occurrences of the search string with the replacement string </DT ><DT ><A HREF="function.str-rot13.html" >str_rot13</A > -- Perform the rot13 transform on a string</DT ><DT ><A HREF="function.str-shuffle.html" >str_shuffle</A > -- Randomly shuffles a string</DT ><DT ><A HREF="function.str-word-count.html" >str_word_count</A > -- Return information about words used in a string </DT ><DT ><A HREF="function.strcasecmp.html" >strcasecmp</A > -- Binary safe case-insensitive string comparison </DT ><DT ><A HREF="function.strchr.html" >strchr</A > -- Find the first occurrence of a character </DT ><DT ><A HREF="function.strcmp.html" >strcmp</A > -- Binary safe string comparison</DT ><DT ><A HREF="function.strcoll.html" >strcoll</A > -- Locale based string comparison</DT ><DT ><A HREF="function.strcspn.html" >strcspn</A > -- Find length of initial segment not matching mask </DT ><DT ><A HREF="function.strip-tags.html" >strip_tags</A > -- Strip HTML and PHP tags from a string</DT ><DT ><A HREF="function.stripcslashes.html" >stripcslashes</A > -- Un-quote string quoted with <A HREF="function.addcslashes.html" ><B CLASS="function" >addcslashes()</B ></A > </DT ><DT ><A HREF="function.stripslashes.html" >stripslashes</A > -- Un-quote string quoted with <A HREF="function.addslashes.html" ><B CLASS="function" >addslashes()</B ></A > </DT ><DT ><A HREF="function.stristr.html" >stristr</A > -- Case-insensitive <A HREF="function.strstr.html" ><B CLASS="function" >strstr()</B ></A > </DT ><DT ><A HREF="function.strlen.html" >strlen</A > -- Get string length</DT ><DT ><A HREF="function.strnatcasecmp.html" >strnatcasecmp</A > -- Case insensitive string comparisons using a "natural order" algorithm </DT ><DT ><A HREF="function.strnatcmp.html" >strnatcmp</A > -- String comparisons using a "natural order" algorithm </DT ><DT ><A HREF="function.strncasecmp.html" >strncasecmp</A > -- Binary safe case-insensitive string comparison of the first n characters </DT ><DT ><A HREF="function.strncmp.html" >strncmp</A > -- Binary safe string comparison of the first n characters </DT ><DT ><A HREF="function.strpos.html" >strpos</A > -- Find position of first occurrence of a string </DT ><DT ><A HREF="function.strrchr.html" >strrchr</A > -- Find the last occurrence of a character in a string </DT ><DT ><A HREF="function.strrev.html" >strrev</A > -- Reverse a string</DT ><DT ><A HREF="function.strrpos.html" >strrpos</A > -- Find position of last occurrence of a char in a string </DT ><DT ><A HREF="function.strspn.html" >strspn</A > -- Find length of initial segment matching mask </DT ><DT ><A HREF="function.strstr.html" >strstr</A > -- Find first occurrence of a string</DT ><DT ><A HREF="function.strtok.html" >strtok</A > -- Tokenize string</DT ><DT ><A HREF="function.strtolower.html" >strtolower</A > -- Make a string lowercase</DT ><DT ><A HREF="function.strtoupper.html" >strtoupper</A > -- Make a string uppercase</DT ><DT ><A HREF="function.strtr.html" >strtr</A > -- Translate certain characters</DT ><DT ><A HREF="function.substr-count.html" >substr_count</A > -- Count the number of substring occurrences</DT ><DT ><A HREF="function.substr-replace.html" >substr_replace</A > -- Replace text within a portion of a string</DT ><DT ><A HREF="function.substr.html" >substr</A > -- Return part of a string</DT ><DT ><A HREF="function.trim.html" >trim</A > -- Strip whitespace from the beginning and end of a string </DT ><DT ><A HREF="function.ucfirst.html" >ucfirst</A > -- Make a string's first character uppercase</DT ><DT ><A HREF="function.ucwords.html" >ucwords</A > -- Uppercase the first character of each word in a string </DT ><DT ><A HREF="function.vprintf.html" >vprintf</A > -- Output a formatted string</DT ><DT ><A HREF="function.vsprintf.html" >vsprintf</A > -- Return a formatted string</DT ><DT ><A HREF="function.wordwrap.html" >wordwrap</A > -- Wraps a string to a given number of characters using a string break character. </DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.stream-set-write-buffer.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.addcslashes.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >stream_set_write_buffer</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >addcslashes</TD ></TR ></TABLE ></DIV ></BODY ></HTML >