Related Topics
PHP sprintf() Function
PHP sprintf() Function The sprintf() function in PHP is used to write a formatted string to a variable and returns a formatted string. PHP 4 and above versions support the sprintf() function. The related functions are...
8 minutes read.
PHP uksort() Function
PHP uksort() Function The uksort() function in PHP sorts an array by keys using a user-defined comparison function. Syntax uksort ( array &$array , callable $key_compare_func ) Parameter array(required)- This parameter represents the input array. key_compare_func(required)- This parameter represents a string that describe a callable comparison function....
1 minute read.
PHP strtr() Function
PHP strtr() Function The strtr() function in PHP translates or replaces certain characters in a string. Syntax strtr ( string $str , string $from , string $to ) or strtr ( string $str , array $replace_pairs ) Parameter str(required)- This parameter specifies the string to translate from(required)- This parameter represents the string being translated to the parameter ‘to’. to(required)- It specifies what...
1 minute read.
PHP nl2br() Function
PHP nl2br() Function The nl2br() function in PHP inserts HTML line breaks before all newlines in a string. Syntax nl2br ( string $string [, bool $is_xhtml] ) Parameter sting(required)- This parameter specifies the input string. is_xhtml(optional)- This parameter states whether to use XHTML compatible line breaks...
1 minute read.
PHP strcasecmp() Function
PHP strcasecmp() Function The strcasecmp() function in PHP compares two strings. It is a binary-safe case-insensitive string function. Syntax strcasecmp ( string $str1 , string $str2 ) Parameter str1(required)- This parameter represents the first string. str2(required)- This parameter represents the second string. Return This function returns a value less than( <...
1 minute read.
PHP soundex() Function
PHP soundex() Function The soundex() function in PHP Calculates the soundex key(four character long alphanumeric string that represent English pronunciation of a word) of a string. Syntax soundex ( string $str ) Parameter str(required) – This parameter represents the input string. Return This function returns the soundex...
1 minute read.
PHP array_chunk() Function
PHP array_chunk() Function The array_chunk() function in PHP is used to split an array into chunks where the last chunk may contain less than size elements. Syntax array_chunk ( array $array , int $size [, bool $preserve_keys ]...
1 minute read.
PHP array_product() Function
PHP array_product() Function The array_product() function in PHP calculates the product of values in an array. Syntax array_product ( array $array ) Parameter array(required)- This parameter represents the input array. Return This function returns the product of the array elements as an integer or float....
1 minute read.
PHP str_shuffle() Function
PHP str_shuffle() Function The str_shuffle() function in PHP randomly shuffles all the characters of the specified string. Syntax str_shuffle ( string $str ) Parameter str(required)- This parameter represents the input string to shuffle. Return This function returns the shuffled string. Example 1 ...
1 minute read.
PHP Array Functions
There are various array functions in PHP. They are used to access and manipulate the elements ofan array. Following are functions of array. Array Function Description array() It is used to create an array. array_change_key_case() It is...
3 minutes read.
PHP gettype() Function
PHP gettype() Function The gettype () function in PHP gets the type of the specified variable. Syntax gettype ( mixed $var ) Parameter var(required)- This parameter represents the variable being type checked. Return This function returns the type of the PHP variable specified by “var”...
1 minute read.
PHP compact() function
PHP compact() function The compact() function in PHP is used to create an array containing variables and their values. It returns the output array whose keys are the variable names, and their corresponding values are...
1 minute read.
PHP array_reduce() Function
PHP array_reduce() Function The array_reduce() function in PHP reduces the array to a single value using by applying a callback function to the elements of the array. Syntax array_reduce ( array $array , callable $callback [, mixed $initial = NULL ] ) Parameter array(required)- This parameter represents the input array. callback (required)- This...
1 minute read.
PHP levenshtein() Function
PHP levenshtein() Function The levenshtein() function in PHP calculates the Levenshtein distance between two strings. Syntax levenshtein ( string $str1 , string $str2 , int $cost_ins , int $cost_rep , int $cost_del ) Parameter str1(required)- This parameter signifies one of the strings being evaluated for Levenshtein distance. str2(required)- This parameter signifies one of the strings being evaluated...
1 minute read.
PHP is_long() Function
The PHP is_long () function in PHP is used to find whether a variable is an integer or not. It returns a Boolean value true if the parameter var is integer else it returns...
1 minute read.
PHP get_defined_vars() Function
PHP get_defined_vars() Function The get_defined_vars() function in PHP returns an array of all defined variables. It returns a multidimensional array containing a list of all defined variables. Syntax get_defined_vars ( void ) Parameter NA Return This function returns a multidimensional array containing a list...
1 minute read.
PHP quoted_printable_encode() Function
PHP quoted_printable_encode() Function The quoted_printable_encode() function in PHP converts a 8 bit string to a quoted-printable string. This function is similar to imap_8bit(), except this one does not require the IMAP module to work. Syntax quoted_printable_encode ( string $str ) Parameter str(required)- This parameter represents...
1 minute read.
PHP Explode() Function
PHP Explode The PHP explode( ) is used to break a string into an array. The PHP explode( ) allow us to break a string into a smaller text with each break...
1 minute read.
PHP is_integer() Function
The PHP is_integer() function in PHP is used to find whether a variable is an integer or not. It returns a Boolean value true if the parameter var is integer else it returns...
1 minute read.
PHP array_key_last() function
The array_key_last () function in PHP gets the last key of an array if the specified array is not empty. Syntax array_key_last ( array $array ) Parameter array(required)- This parameter signifies the input array. Return This function returns the last key of the...
1 minute read.

