PHP str_split() Function

P
PHP str_shuffle() Function
PHP str_word_count() Function

WHAT IS THE SYNTAX OF THE STR_SPLIT()FUNCTION IN PHP?

str_split(string,length)
ParameterDescription
stringRequired. Specifies the string to split
lengthOptional. Specifies the length of each array element. Default is 1
PHP STR_SPLIT() method

EXAMPLES OF THE STR_SPLIT() FUNCTION

Example 1. In this example, we split the string “Hello” into an array.

<?php
print_r(str_split("Hello"));
?>

Example 2. In this example, we use the length parameter.

<?php
print_r(str_split("Hello",3));
?>
PHP str_shuffle() Function
PHP str_word_count() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z