> Online tutorial : str_split() in php
Showing posts with label str_split() in php. Show all posts
Showing posts with label str_split() in php. Show all posts

str_split() in php

The str_split() function splits the string into an array
Syntax
str_split(string,length)
Example

<?php
// split the string into an array
print_r(str_split("hello"));
print_r(str_split("hello",2));
?>

Output
Array([0]=>h
[1]=>e
[2]=>l
[3]=>l
[4]=>o
)
Array([0]=>he
[1]=>ll
[2]=>o)