Page 1 of 1
separating letters in a string
Posted: Mon Jan 01, 2007 12:58 am
by jetboy790
I was wondering if there was a function that lets you separate the letters in a single word string , either to an array or another string with separators.
Thanks
Posted: Mon Jan 01, 2007 1:42 am
by brendandonhue
Does this help?
Code: Select all
<?php
$string = 'Hello, world!';
echo $string{0};
?>
Posted: Mon Jan 01, 2007 2:28 am
by jetboy790
well what i was looking for was a function that would break a string into an array of letters so :
Code: Select all
<?php
$var = "hello";
$letters = array ( 'h', 'e', 'l', 'l', 'o');
?>
however that helps alot
Posted: Mon Jan 01, 2007 2:36 am
by jetboy790
found it : str_split()
Thanks anyway