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

Navigation:

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






 
 

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