074 - String Split Function , break and store every value of string(word) in array formArray
(
[0] => Y
[1] => a
[2] => h
[3] => o
[4] => o
[5] =>
[6] => B
[7] => a
[8] => b
[9] => a
)
074-a - String Split Function , using lenghtArray
(
[0] => Yah
[1] => oo
[2] => Bab
[3] => a
)
074-b - String Chunk Function, split the string and add other stirng between themY.a.h.o.o. .B.a.b.a.
Yah-oo -Bab-a-
Yah
oo
Bab
a
<?php
// 074 - String Split Function , break and store every value of string(word) in array form
echo "</br><span class='myheading'>074 - String Split Function , break and store every value of string(word) in array form</span></br>";
$str = "Yahoo Baba";
$array = str_split($str);
echo "<pre>";
print_r($array);
echo "</pre>";
// 074-a - String Split Function , using lenght
echo "</br><span class='myheading'>074-a - String Split Function , using lenght</span></br>";
$array2 = str_split($str, 3);
echo "<pre>";
print_r($array2);
echo "</pre>";
// 074-b - String Chunk Function, split the string and add other stirng between them
echo "</br><span class='myheading'>074-b - String Chunk Function, split the string and add other stirng between them</span></br>";
$newStr = chunk_split($str,1,".");
echo $newStr.'<br><br>';
$newStr = chunk_split($str,3,"-");
echo $newStr.'<br><br>';
$newStr = chunk_split($str,3,"<br>");
echo $newStr.'<br><br>';
?>