hi, welcome to Webune.com Web Hosting Support. We provide free support to all our valued customers. in this short tutorial we will show you how you can split a string into letters using an array in php.

Do you have PHP on your website? if you dont, sign up with one of our economical web hosting packages which inlocude PHP and MySQL so you can start doing this tutoril live on your site.

so lets say i have a string like this:

$foo = "webune";

and i want to divide the whole webune word into individual values. well you can, using PHP str_split() function.

so lets continue with our example here, this is how we would divide the $foo string into separate values.

if you have windows, i am using windows XP, you should have notepad. open a blank notepad and copy and paste the following code:

<?php
######################################################
# DISTRIBUTED UNDER GLP/UGN COPY RIGHTS BY WEBUNE.COM
######################################################
?>
<h1>How to divide string to letters php</h1>
By <a href="http://www.webune.com">Webune.com</a>
<hr />
<form action="" method="post">
Enter a Word you want to split: <input type="text" name="foo" / >
<input type="submit" name="submit" value="submit" / >
</form>
<?php
if(isset($_POST['foo'])){
$foo = str_split($_POST['foo']);
echo '<pre style="color:blue">';
print_r($foo);
echo '</pre>';
echo 'for more cool tutorials visit us at <a href="http://www.webune.com">Webune.com</a>';
}
?>


now save as.. "word-split.php"
[NOTE: be sure to include the quotes when saving as to be sure notepad saves the file as a php file]

now upload to your website which has PHP, then point the browser to word-split.php where you uploaded.

and give it a try, you will see when you enter a word, it will divide it into sections using an array.

hope that helps