WesleyA Posted January 11, 2016 Share Posted January 11, 2016 I want to transfer a string (several values ) into a php array. I know explode is used to do that. But is explode the only way or are there other ways to do this in php? Link to comment Share on other sites More sharing options...
Ingolme Posted January 11, 2016 Share Posted January 11, 2016 It depends on what rules you want to use to convert the string into an array. There's str_split() if you want to break the string into equally sized array pieces, preg_split() works like explode() except that it uses a regular expression as the delimiter. If you tell us what exactly you're trying to do with the string then we can be more specific with how to turn it into an array. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now