Live Example of PHP Functions
Share this page

Live Example of PHP Functions

PHP Function Description
addslashes() Add backslashes (\) in front of each character that needs to be quoted in a database query.
base_convert() Converts a number between two bases.
crc32() Generates the cyclic redundancy checksum (CRC) of a given string.
crypt() Calculates the hash of a string using the standard Unix DES-based encryption algorithm.
decbin() Takes an integer (base-10) and converts it to a binary (base-2) number.
decoct() Takes an integer (base-10) and converts it to a octal (base-8) number.
dechex() Takes an integer (base-10) and converts it to a hexadecimal (base-16) number.
dns_get_record() Fetches the DNS resource records associated with the given hostname.
htmlspecialchars() Convert special characters to HTML entities.
lcfirst() Converts the first character of the input string into a lowercase letter.
md5() Calculates the MD5 hash of a string using the RSA Data Security, Inc.
openssl_encrypt() Encrypts data with the algorithm and key you provide.
openssl_decrypt() Decrypts cipher/encrypted data.
openssl_get_cipher_methods() Returns the cipher method available on a server that can be used.
preg_match() Performs regular expression match.
sha1() Calculates the SHA1 hash of a string.
str_word_count() Returns the number of words of a given string.
strlen() Returns the length (number of characters) of a given string.
strip_tags() Strip HTML and PHP tags from a string.
stripslashes() Returns a string with the backslashes (\) removed that were added by the addslashes() function.
strrev() Returns a reverse order of a string.
strtolower() Returns a string with all the alphabetic characters of the input string converted to lowercase.
strtoupper() Returns a string with all the alphabetic characters of the input string converted to uppercase.
ucfirst() Converts the first character of the input string into an uppercase letter.
ucwords() Returns a string with the first letter of each word in the input string converted to uppercase.
urlencode() Encodes a string to be used in a query part of a URL. All non-alphanumerica characters (except hypens, underscores, and periods) are replaced with percentage (%) signs followed by a two-digit hex code
urldecode() Decodes the query part of a URL string.