String Functions
These are the basic string manipulation functions supported by PHP. They are all 8-bit clean, which means that the data they act on does not necessarily have to be straight text. In other words, a string may include any character in the ASCII table including 0. Here are the string functions:
string addslashes(string str)
Escape single quotes, double quotes, and backslash characters in a string with backslashes
string base64_decode(string str)
Decode a string with MIME base-64
string base64_encode(string str)
Encode a string with MIME base-64
string chop(string str)
Remove trailing whitespace
string chr(int ascii)
Convert an ASCII code to a character
string chunk_split(string str [, int chunklen [,
string ending]])
Return split line
string convert_cyr_string(string str, string
from, string to)
Convert from one Cyrillic character set to another
string crypt(string str [, string salt])
DES-encrypt a string
string decrypt(string data, int type, string
key)
Decrypt string with
key
using algorithmtype
(converse ofencrypt( )
)string encrypt(string data, int type, string
key)
Encrypts string with
key
using algorithmtype
(converse ofdecrypt( )
)int ereg(string pattern, string string [, array
registers])
POSIX-style regular expression match
string ereg_replace(string pattern, string
string [, array registers])
Replace pattern in a string using a POSIX-style regular expression
int eregi(string pattern, string string [, array
registers])
Case-insensitive POSIX-style regular expression match ...
Get PHP Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.