PHP chunk_split() Function

PHP chunk_split() function is “used to split a string into smaller chunks of a specific length.” It doesn’t modify the original string. Syntax string chunk_split($string, $length, $end) Parameters $string(required): It specifies a string which is needed to be chunked. $length(optional): It is the size of each chunk. By default, it’s 76 characters. $end(optional): It specifies … Read more

PHP str_split() Function

PHP str_split() function is “used to convert the string into an array.”  Syntax str_split($string, $length) Parameters $string: This is an input string. $length: It specifies the length of each array element. The default is 1. Return value If the length is larger than the length of the string, the entire string will be returned as … Read more

PHP strtok() Function

PHP strtok() function is “used to tokenize a string into smaller parts based on given delimiters.” Syntax strtok($string, $delimiters) Parameters $string(required): It defines the string. $delimiters(required):  It is used when splitting up the string. Return value It returns a string token, or false if there are no more tokens available. Visual Representation Example 1: How … Read more

PHP strstr() Function

PHP strstr() function is used to find the first occurrence of a string inside another string. This function is case-sensitive. Syntax strstr($string, $search, $before_search) Parameters $string(required): It is an input string. $search(required): It is the string you are searching for. $before_search(optional): The boolean value whose default is “false“. If it is set to “true”, it … Read more

PHP password_hash() Function

PHP password_hash() function is used to create a password hash. This function is compatible with the crypt() function. Therefore, password hashes created by the crypt() function can be used with the password_hash() function. Syntax string password_hash( string $password , integer $algo [, array $options ] ) Parameters $password(required): It is the password to be hashed. … Read more

PHP header() Function

PHP header() function is “used to send a raw HTTP header to a client.” The header() must be called before any output is sent, either by standard HTML tags, blank lines in the file, or PHP. Syntax header( $header, $replace = TRUE, $http_response_code ) Parameters $header(required): It holds the header string.  $replace(optional): It denotes that … Read more

PHP strpos() Function

PHP strpos() function is “used to find the position of the first occurrence of a substring within a string. ” This function is case-sensitive and binary-safe. Syntax strpos($string, find, start) Parameters $string(required): It specifies the string to search find(required): It specifies the string to find. start(optional): It specifies the starting position for the search within … Read more

PHP join() Function

PHP join() function is “used to join an array of elements separated by a string.” This function is an alias of an implode() function.  Syntax join($separator,$array) Parameters $separator(optional): The separator is used between each element of the array when concatenating. The default is an empty string(“”). $array(required): It is the array to join. Return value It … Read more

PHP str_replace() Function

PHP str_replace() function is used to replace all occurrences of a search string with a replacement string in a given string or an array of strings. This function is case-sensitive. Use the str_ireplace() function to perform a case-insensitive search. Syntax str_replace($search, $replace, $string, $count) Parameters $search(required): It is the value being searched for. $replace(required): It is … Read more

PHP array_search() Function

PHP array_search() function is “used to search for a specific value in an array, and if the value is found, it returns its corresponding key.” If there is more than one value then the first matching key is returned. array_search is case-sensitive when searching for strings. Syntax array_search($value, $array, strict) Parameters value(required): It specifies the … Read more

PHP array_combine() Function

PHP array_combine() function is “used to combine two arrays and create a new array by using one array for keys and another array for values.” The number of elements in both arrays must be equal, as the function returns false if the number of elements does not match. Syntax array_combine(keys,values); Parameters keys: It is required … Read more