Alexk Posted October 6, 2007 Share Posted October 6, 2007 I am trying too make a very basic spellcheck script. The start of the script needs to break down a string into seperate characters. The problem is that my server runs PHP 4, and sr_split needs PHP 5. Any ideas ??? Link to comment https://forums.phpfreaks.com/topic/72114-solved-str_split-funtion-help/ Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 try this function strsplit($data) { return preg_split('/./si', $data); } EDIT: i check php.net to check if preg_split was support by 4 (just had to check) and found this <?php $str = 'string'; $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); print_r($chars); ?> Link to comment https://forums.phpfreaks.com/topic/72114-solved-str_split-funtion-help/#findComment-363540 Share on other sites More sharing options...
sasa Posted October 6, 2007 Share Posted October 6, 2007 try <?php $a = 'sasa'; for ($i = 0; $i < strlen($a); $i++) echo $a[$i], "<br />\n"; ?>f/code] Link to comment https://forums.phpfreaks.com/topic/72114-solved-str_split-funtion-help/#findComment-363547 Share on other sites More sharing options...
Alexk Posted October 13, 2007 Author Share Posted October 13, 2007 thanks, it works now! Link to comment https://forums.phpfreaks.com/topic/72114-solved-str_split-funtion-help/#findComment-368689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.