<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >String</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Referência das Funções" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="stream_wrapper_unregister" HREF="function.stream-wrapper-unregister.html"><LINK REL="NEXT" TITLE="addcslashes" HREF="function.addcslashes.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></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" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.stream-wrapper-unregister.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.addcslashes.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.strings" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CLXI. String</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN218390" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.intro" >Introdução</A ></H1 ><P > Todas estas funções manipulam strings de vários meios. Algumas seções mais especializadas podem ser encontradas nas seções de expressões regulares e <A HREF="ref.url.html" >Funções de URL</A >. </P ><P > Para informação de como as strings funcionam, especialmente sobre o uso de apóstrofo, aspas e sequências de escape veja <A HREF="language.types.string.html" >Strings</A > na seção <A HREF="language.types.html" >Tipos</A > do manual. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.requirements" >Dependências</A ></H1 ><P >Nenhuma biblioteca externa é necessária para compilar esta extensão.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.installation" >Instalação</A ></H1 ><P >Não há nenhuma instalação necessária para utilizar estas funções, elas fazem parte do núcleo do PHP.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="string.constants" >Constantes pré-definidas</A ></H1 ><P > As contantes abaixo são definidas por esta extensão e somente estarão disponíveis quando a extensão foi compilada com o PHP ou carregada dinamicamente durante a execução. </P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >CRYPT_SALT_LENGTH</B ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >CRYPT_STD_DES</B ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >CRYPT_EXT_DES</B ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >CRYPT_MD5</B ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >CRYPT_BLOWFISH</B ></TT > <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A ></DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >HTML_SPECIALCHARS</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >HTML_ENTITIES</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >ENT_COMPAT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >ENT_QUOTES</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >ENT_NOQUOTES</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >CHAR_MAX</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_CTYPE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_NUMERIC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_TIME</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_COLLATE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_MONETARY</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_ALL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >LC_MESSAGES</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >STR_PAD_LEFT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >STR_PAD_RIGHT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >STR_PAD_BOTH</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="strings.seealso" >Veja também</A ></H1 ><P > Para funções de manuseio de string mais poderosas, de uma olhada em <A HREF="ref.regex.html" >funções de expressão regular POSIX</A > e <A HREF="ref.pcre.html" >funções de expressão regular compatíveis com Perl </A >. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Índice</B ></DT ><DT ><A HREF="function.addcslashes.html" >addcslashes</A > -- String entre aspas com barras no estilo C </DT ><DT ><A HREF="function.addslashes.html" >addslashes</A > -- Adiciona barras invertidas a uma string</DT ><DT ><A HREF="function.bin2hex.html" >bin2hex</A > -- Converte um dado binário em hexadecimal </DT ><DT ><A HREF="function.chop.html" >chop</A > -- Alias de <A HREF="function.rtrim.html" ><B CLASS="function" >rtrim()</B ></A ></DT ><DT ><A HREF="function.chr.html" >chr</A > -- Retorna um caracter específico</DT ><DT ><A HREF="function.chunk-split.html" >chunk_split</A > -- Divide uma string em pequenos pedaços</DT ><DT ><A HREF="function.convert-cyr-string.html" >convert_cyr_string</A > -- Converte de um caracter cirílico para outro </DT ><DT ><A HREF="function.convert-uudecode.html" >convert_uudecode</A > -- Decode a uuencoded string </DT ><DT ><A HREF="function.convert-uuencode.html" >convert_uuencode</A > -- Uuencode a string </DT ><DT ><A HREF="function.count-chars.html" >count_chars</A > -- Retorna informações sobre os caracteres usados numa string </DT ><DT ><A HREF="function.crc32.html" >crc32</A > -- Calcula polinômio crc32 de uma string</DT ><DT ><A HREF="function.crypt.html" >crypt</A > -- Único caminho de codificação de string (hashing)</DT ><DT ><A HREF="function.echo.html" >echo</A > -- Exibe uma ou mais strings</DT ><DT ><A HREF="function.explode.html" >explode</A > -- Divide uma string em strings</DT ><DT ><A HREF="function.fprintf.html" >fprintf</A > -- Escreve uma string formatada para um stream</DT ><DT ><A HREF="function.get-html-translation-table.html" >get_html_translation_table</A > -- Retorna a tabela de tradução usada por <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A > e <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A > </DT ><DT ><A HREF="function.hebrev.html" >hebrev</A > -- Converte texto lógico Hebraico para texto visual </DT ><DT ><A HREF="function.hebrevc.html" >hebrevc</A > -- Converte um texto lógico Hebráico para um texto visual com conversão newline </DT ><DT ><A HREF="function.html-entity-decode.html" >html_entity_decode</A > -- Converte todas as entidades HTML para os seus caracteres </DT ><DT ><A HREF="function.htmlentities.html" >htmlentities</A > -- Converte todos os caracteres para HTML entities </DT ><DT ><A HREF="function.htmlspecialchars-decode.html" >htmlspecialchars_decode</A > -- Convert special HTML entities back to characters </DT ><DT ><A HREF="function.htmlspecialchars.html" >htmlspecialchars</A > -- Converte caracteres especiais para a realidade HTML </DT ><DT ><A HREF="function.implode.html" >implode</A > -- Junta elementos de uma matriz em uma string</DT ><DT ><A HREF="function.join.html" >join</A > -- Sinônimo de <A HREF="function.implode.html" ><B CLASS="function" >implode()</B ></A ></DT ><DT ><A HREF="function.levenshtein.html" >levenshtein</A > -- Calcula a distância Levenshtein entre duas strings </DT ><DT ><A HREF="function.localeconv.html" >localeconv</A > -- Obtém a informação da formatação numérica</DT ><DT ><A HREF="function.ltrim.html" >ltrim</A > -- Retira whitespace do início da string </DT ><DT ><A HREF="function.md5-file.html" >md5_file</A > -- Calcula hash md5 de um dado arquivo</DT ><DT ><A HREF="function.md5.html" >md5</A > -- Calcula o "hash MD5" de uma string</DT ><DT ><A HREF="function.metaphone.html" >metaphone</A > -- Calcula a metaphone key de uma string</DT ><DT ><A HREF="function.money-format.html" >money_format</A > -- Formata um número como uma string de moeda</DT ><DT ><A HREF="function.nl-langinfo.html" >nl_langinfo</A > -- Retorna informação de linguagem e local </DT ><DT ><A HREF="function.nl2br.html" >nl2br</A > -- Insere quebras de linha HTML antes de todas newlines em uma string </DT ><DT ><A HREF="function.number-format.html" >number_format</A > -- Formata um número com os milhares agrupados</DT ><DT ><A HREF="function.ord.html" >ord</A > -- Retorna o valor ASCII do caractere</DT ><DT ><A HREF="function.parse-str.html" >parse_str</A > -- Converte a string em variáveis</DT ><DT ><A HREF="function.print.html" >print</A > -- Mostra uma string</DT ><DT ><A HREF="function.printf.html" >printf</A > -- Mostra uma string formatada</DT ><DT ><A HREF="function.quoted-printable-decode.html" >quoted_printable_decode</A > -- Converte uma string quoted-printable para uma string de 8 bit </DT ><DT ><A HREF="function.quotemeta.html" >quotemeta</A > -- Adiciona uma barra invertida antes dos meta caracteres</DT ><DT ><A HREF="function.rtrim.html" >rtrim</A > -- Retira espaço em branco do final da string </DT ><DT ><A HREF="function.setlocale.html" >setlocale</A > -- Define informações locais</DT ><DT ><A HREF="function.sha1-file.html" >sha1_file</A > -- Calcula a hash sha1 de um arquivo</DT ><DT ><A HREF="function.sha1.html" >sha1</A > -- Calcula a hash sha1 de uma string</DT ><DT ><A HREF="function.similar-text.html" >similar_text</A > -- Calcula a similaridade entre duas strings </DT ><DT ><A HREF="function.soundex.html" >soundex</A > -- Calcula a chave soundex de uma string</DT ><DT ><A HREF="function.sprintf.html" >sprintf</A > -- Retorna uma string formatada</DT ><DT ><A HREF="function.sscanf.html" >sscanf</A > -- Interpreta a entrada de uma string de acordo com um formato </DT ><DT ><A HREF="function.str-getcsv.html" >str_getcsv</A > -- Parse a CSV string into an array </DT ><DT ><A HREF="function.str-ireplace.html" >str_ireplace</A > -- Versão que não diferencia maiúsculas e minúsculas de <A HREF="function.str-replace.html" ><B CLASS="function" >str_replace()</B ></A >. </DT ><DT ><A HREF="function.str-pad.html" >str_pad</A > -- Preenche uma string para um certo tamanho com outra string </DT ><DT ><A HREF="function.str-repeat.html" >str_repeat</A > -- Repete uma string</DT ><DT ><A HREF="function.str-replace.html" >str_replace</A > -- Substitui todas as ocorrências da string de procura com a string de substituição </DT ><DT ><A HREF="function.str-rot13.html" >str_rot13</A > -- Executa a transformação rot13 em uma string</DT ><DT ><A HREF="function.str-shuffle.html" >str_shuffle</A > -- Mistura uma string aleatoriamente</DT ><DT ><A HREF="function.str-split.html" >str_split</A > -- Converte uma string para um array </DT ><DT ><A HREF="function.str-word-count.html" >str_word_count</A > -- Retorna informação sobre as palavras usadas em uma string </DT ><DT ><A HREF="function.strcasecmp.html" >strcasecmp</A > -- Comparação de strings sem diferenciar maiúsculas e minúsculas segura para binário </DT ><DT ><A HREF="function.strchr.html" >strchr</A > -- Apelido para <A HREF="function.strstr.html" ><B CLASS="function" >strstr()</B ></A > </DT ><DT ><A HREF="function.strcmp.html" >strcmp</A > -- Comparação de string segura para binário</DT ><DT ><A HREF="function.strcoll.html" >strcoll</A > -- Comparação de string baseada no local</DT ><DT ><A HREF="function.strcspn.html" >strcspn</A > -- Encontra o tamanho do segmento inicial que não contenha a mascara </DT ><DT ><A HREF="function.strip-tags.html" >strip_tags</A > -- Retira as tags HTML e PHP de uma string</DT ><DT ><A HREF="function.stripcslashes.html" >stripcslashes</A > -- Desfaz o efeito de <A HREF="function.addcslashes.html" ><B CLASS="function" >addcslashes()</B ></A > </DT ><DT ><A HREF="function.stripos.html" >stripos</A > -- Encontra a primeira ocorrencia de uma string sem diferenciar maiúsculas e minúsculas </DT ><DT ><A HREF="function.stripslashes.html" >stripslashes</A > -- Desfaz o efeito de <A HREF="function.addslashes.html" ><B CLASS="function" >addslashes()</B ></A > </DT ><DT ><A HREF="function.stristr.html" >stristr</A > -- <A HREF="function.strstr.html" ><B CLASS="function" >strstr()</B ></A > sem diferenciar maiúsculas e minúsculas </DT ><DT ><A HREF="function.strlen.html" >strlen</A > -- Retorna o tamanho de uma string</DT ><DT ><A HREF="function.strnatcasecmp.html" >strnatcasecmp</A > -- Comparação de strings sem diferenciar maiúsculas/minúsculas usando o algoritmo "natural order" </DT ><DT ><A HREF="function.strnatcmp.html" >strnatcmp</A > -- Comparação de strings usando o algoritmo "natural order" </DT ><DT ><A HREF="function.strncasecmp.html" >strncasecmp</A > -- Comparação de string caso-sensitivo de Binário seguro dos primeiros n caracteres </DT ><DT ><A HREF="function.strncmp.html" >strncmp</A > -- Comparação de string segura para binário para os primeiros n caracteres </DT ><DT ><A HREF="function.strpbrk.html" >strpbrk</A > -- Search a string for any of a set of characters </DT ><DT ><A HREF="function.strpos.html" >strpos</A > -- Encontra a posição da primeira ocorrência de uma string </DT ><DT ><A HREF="function.strrchr.html" >strrchr</A > -- Encontra a ultima ocorrência de um caractere em uma string </DT ><DT ><A HREF="function.strrev.html" >strrev</A > -- Reverte uma string</DT ><DT ><A HREF="function.strripos.html" >strripos</A > -- Encontra a posição da última ocorrência de uma string case-insensitive em uma string </DT ><DT ><A HREF="function.strrpos.html" >strrpos</A > -- Encontra a posição da última ocorrência de um caractere em uma string </DT ><DT ><A HREF="function.strspn.html" >strspn</A > -- Encontra o comprimento do segmento inicial combinando com a máscara </DT ><DT ><A HREF="function.strstr.html" >strstr</A > -- Encontra a primeira ocorrencia de uma string</DT ><DT ><A HREF="function.strtok.html" >strtok</A > -- Tokeniza uma string</DT ><DT ><A HREF="function.strtolower.html" >strtolower</A > -- Converte uma string para minúsculas</DT ><DT ><A HREF="function.strtoupper.html" >strtoupper</A > -- Converte uma string para maiúsculas</DT ><DT ><A HREF="function.strtr.html" >strtr</A > -- Traduz certos caracteres</DT ><DT ><A HREF="function.substr-compare.html" >substr_compare</A > -- A comparação binária entre duas strings case-insensitive de um offset é guardada opcionalmente, até o limite do comprimento de caracteres </DT ><DT ><A HREF="function.substr-count.html" >substr_count</A > -- Conta o número de ocorrências de uma substring</DT ><DT ><A HREF="function.substr-replace.html" >substr_replace</A > -- Substitui o texto dentro de uma parte de uma string</DT ><DT ><A HREF="function.substr.html" >substr</A > -- Retorna uma parte de uma string</DT ><DT ><A HREF="function.trim.html" >trim</A > -- Retira espaço no ínicio e final de uma string </DT ><DT ><A HREF="function.ucfirst.html" >ucfirst</A > -- Converte para maiúscula o primeiro caractere de uma string</DT ><DT ><A HREF="function.ucwords.html" >ucwords</A > -- Converte para maiúsculas o primeiro caractere de cada palavra </DT ><DT ><A HREF="function.vfprintf.html" >vfprintf</A > -- Write a formatted string to a stream</DT ><DT ><A HREF="function.vprintf.html" >vprintf</A > -- Mostra uma string formatada</DT ><DT ><A HREF="function.vsprintf.html" >vsprintf</A > -- Retorna uma string formatada</DT ><DT ><A HREF="function.wordwrap.html" >wordwrap</A > -- Quebra uma string em linhas usando um caractere de quebra de linha. </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-wrapper-unregister.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.addcslashes.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >stream_wrapper_unregister</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >addcslashes</TD ></TR ></TABLE ></DIV ></BODY ></HTML >