CurrentlyPHP function explode() splits a string into an array
explode(separator,string,limit)
separator is required. Specifies where to split the string.
string required. The string to split.
limit optional. Specifies the maximum number of array elements returned.
PHP function explode() example
<ol class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">php</span><span> </span></span></li><li><span>$</span><span class="attribute">str</span><span> = </span><span class="attribute-value">"Hello world. It's a beautiful day."</span><span>; </span></li><li class="alt"><span>print_r (explode(" ",$str)); </span></li><li><span class="tag">?></span><span> </span></span></li></ol>
Output:
<ol class="dp-xml"> <li class="alt"><span><span>Array </span></span></li> <li><span>( </span></li> <li class="alt"> <span>[0] =</span><span class="tag">></span><span> Hello </span> </li> <li> <span>[1] =</span><span class="tag">></span><span> world. </span> </li> <li class="alt"> <span>[2] =</span><span class="tag">></span><span> It's </span> </li> <li> <span>[3] =</span><span class="tag">></span><span> a </span> </li> <li class="alt"> <span>[4] =</span><span class="tag">></span><span> beautiful </span> </li> <li> <span>[5] =</span><span class="tag">></span><span> day. </span> </li> <li class="alt"><span>) </span></li> </ol>
The above code example is the specific use of PHP function explode() .