Jragon Posted July 23, 2010 Share Posted July 23, 2010 Hello, I need to make a string ' $sting = 'abc' ' to and array ' $sting = array('a', 'b', 'c') ' Any idea on how i could do this would be much apreachated Thanks Jarogn Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/ Share on other sites More sharing options...
freelance84 Posted July 23, 2010 Share Posted July 23, 2010 will the "$sting" always be abc? Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090120 Share on other sites More sharing options...
Jragon Posted July 23, 2010 Author Share Posted July 23, 2010 No it will be a random string with many symbols and other stuff that is about 185 charicters long Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090121 Share on other sites More sharing options...
Alex Posted July 23, 2010 Share Posted July 23, 2010 $str = 'abc'; $arr = str_split($str); str_split Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090122 Share on other sites More sharing options...
Jragon Posted July 23, 2010 Author Share Posted July 23, 2010 will it add '' in between them? Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090123 Share on other sites More sharing options...
gwolgamott Posted July 23, 2010 Share Posted July 23, 2010 will it add '' in between them? What do you mean will it add '' between them? That just straight up splits the string up into an array with a length of one for each array element. What alex has shown will take this >>> $str = 'abc' to and do this >>> $arr = array('a', 'b', 'c') Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090127 Share on other sites More sharing options...
Jragon Posted July 23, 2010 Author Share Posted July 23, 2010 Ok Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/208665-strings-to-an-array/#findComment-1090128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.