Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Books
Software
Downloads
Hosting
manuals
Forums
Script directory
Training
Our Links

ADD TO Progged Progged
ADD TO DEL.ICIO.US Del.icio.
ADD TO DIGG Digg
ADD TO FURL Furl
ADD TO NEWSVINE Newsvine
ADD TO NETSCAPE Netscape
ADD TO REDDIT Reddit
ADD TO STUMBLEUPON StumbleUpon
ADD TO TECHNORATI FAVORITES Technorati
ADD TO SQUIDOO Squidoo
ADD TO WINDOWS LIVE Windows Live
ADD TO YAHOO MYWEB Yahoo MyWeb
ADD TO ASK Ask
ADD TO GOOGLE Google
ADD TO MAGNOLIA Magnolia
ADD TO SPURL Spurl



 
 

SPONSORS



 
 

Using the split function

This is an example of using the split function . We first loop through all of the items in the array and we also display one of the items in the array .

Code :

<?php
//using the split function
//our string
$msg1 = "This is a string with spaces between it";
//the pattern
$pattern = " ";
//store in the array $splitstring
$splitstring = split($pattern , $msg1);
//loop through all items in the array
foreach ($splitstring as $value)
echo "$value<br>";
//display one of the items in the array
echo "$splitstring[0]";
?>

Example:

 

This
is
a
string
with
spaces
between
it
This