can you tell how i can use php explode() function?
if i have this for example, how can i display the array in a loop?
<?
$string = "simple sentence with five words";
$words= explode(" ", $string );
?>
Comments and replies About How To Use Explode() Php Function Examples
sure you can, you can use the for loop to get and disaply all the values of the array.
CODE:
<?
$string = "simple sentence with five words";
$words = explode(" ", $string );
for( $i = 0; $i < count($words); ++$i )
echo $i.'. '.$words[$i].'<br>';
?>
OUTPUT:
0. simple
1. sentence
2. with
3. five
4. words
hope this helps.
php web hosting at webune.com!