AbydosGater Posted February 26, 2007 Share Posted February 26, 2007 Hi, I started on a project today and i need to be able to take a string and explode every character into an array, is this possible? I know explode works but it seperates after each character indicated in the function. Is there any way to do this for each character in a string? Thanks, Andy. Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/ Share on other sites More sharing options...
Barand Posted February 26, 2007 Share Posted February 26, 2007 PHP5 has str_split(). But you can treat as a string as an array of chars anyway. $str = 'hello; echo $str{1}; // e Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/#findComment-194704 Share on other sites More sharing options...
AbydosGater Posted February 26, 2007 Author Share Posted February 26, 2007 Ah Great Thanks! Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/#findComment-194744 Share on other sites More sharing options...
lifeson2112 Posted February 26, 2007 Share Posted February 26, 2007 That's dope Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/#findComment-194750 Share on other sites More sharing options...
Barand Posted February 26, 2007 Share Posted February 26, 2007 Would you care to explain that comment? Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/#findComment-194754 Share on other sites More sharing options...
AbydosGater Posted February 26, 2007 Author Share Posted February 26, 2007 Whats dope? Its a great answer, exactly what i was looking for.. and quite a quick one at that! Andy Link to comment https://forums.phpfreaks.com/topic/40243-explode-but-for-each-character/#findComment-194755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.