How To Use Explode() Php Function Examples
how to use explode() php function examples
how, to, use, explode, php, function, examples
How To Use Explode() Php Function Examples
Post Description: how to use explode() php function examples
POST# 417
Posted On: Fri Feb 29, 2008 12:01 pm
beginer tutorial
Topic: How To Use Explode() Php Function Examples
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 );
?>


Wed Jun 20, 2007 12:55 pm
1
webune
Reply #1006
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!

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload