0% found this document useful (0 votes)
5 views3 pages

More PHP Functions

The document provides definitions, syntax, and examples for various PHP functions including get_html_translation_table, md5, sha1, and others. Each function is described with its purpose, syntax format, and a sample usage. The functions cover a range of operations from string manipulation to mathematical calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

More PHP Functions

The document provides definitions, syntax, and examples for various PHP functions including get_html_translation_table, md5, sha1, and others. Each function is described with its purpose, syntax format, and a sample usage. The functions cover a range of operations from string manipulation to mathematical calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

More PHP Functions - Definitions, Syntax & Examples

get_html_translation_table()
Definition: Returns the translation table used by htmlspecialchars() and htmlentities().
Syntax: get_html_translation_table([int table, int flags, string encoding])
Example: get_html_translation_table(HTML_ENTITIES);

md5()
Definition: Calculates the MD5 hash of a string.
Syntax: md5(string, bool raw_output = false)
Example: md5("hello"); // 5d41402abc4b2a76b9719d911017c592

sha1()
Definition: Calculates the SHA-1 hash of a string.
Syntax: sha1(string, bool raw_output = false)
Example: sha1("hello"); // aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d

convert_uuencode()
Definition: Encodes a string using the uuencode algorithm.
Syntax: convert_uuencode(string)
Example: convert_uuencode("Test string");

convert_uudecode()
Definition: Decodes a uuencoded string.
Syntax: convert_uudecode(string)
Example: convert_uudecode(encoded_string);

bin2hex()
Definition: Converts binary data into hexadecimal representation.
Syntax: bin2hex(string)
Example: bin2hex("hello"); // 68656c6c6f

hex2bin()
Definition: Converts a hex string into binary data.
Syntax: hex2bin(string)
Example: hex2bin("68656c6c6f"); // hello

chr()
Definition: Returns a character from the specified ASCII value.
Syntax: chr(int ascii)
Example: chr(65); // A

ord()
Definition: Returns the ASCII value of the first character of a string.
Syntax: ord(string)
Example: ord("A"); // 65

strip_tags()
Definition: Strips HTML and PHP tags from a string.
Syntax: strip_tags(string, allow)
Example: strip_tags("<b>Hello</b>"); // Hello

wordwrap()
Definition: Wraps a string to a given number of characters.
Syntax: wordwrap(string, width, break, cut)
Example: wordwrap("This is a long text.", 8, "<br>");

min()
Definition: Finds the minimum value among arguments.
Syntax: min(value1, value2, ...)
Example: min(4, 2, 8); // 2

max()
Definition: Finds the maximum value among arguments.
Syntax: max(value1, value2, ...)
Example: max(4, 2, 8); // 8

abs()
Definition: Returns the absolute value of a number.
Syntax: abs(number)
Example: abs(-5); // 5

floor()
Definition: Rounds a number down to the nearest integer.
Syntax: floor(float)
Example: floor(3.9); // 3
ceil()
Definition: Rounds a number up to the nearest integer.
Syntax: ceil(float)
Example: ceil(3.1); // 4

round()
Definition: Rounds a float to the nearest whole number.
Syntax: round(float, precision)
Example: round(3.456, 2); // 3.46

intdiv()
Definition: Performs integer division.
Syntax: intdiv(dividend, divisor)
Example: intdiv(10, 3); // 3

pow()
Definition: Raises a number to the power of another.
Syntax: pow(base, exponent)
Example: pow(2, 3); // 8

sqrt()
Definition: Returns the square root of a number.
Syntax: sqrt(number)
Example: sqrt(9); // 3

rand()
Definition: Generates a random integer.
Syntax: rand(min, max)
Example: rand(1, 10); // e.g., 7

You might also like