Reputation: 19837
How can I isolate the numbers and words in a string?
So I have something like this:
11111111-test-title
I want to have:
11111111
...in one string and:
test-title
...in another.
Upvotes: 0
Views: 206
Reputation: 67715
list($number, $text) = explode('-', $input, 2);
Or simply explode
to get an array. The third argument tells it to separate it in a maximum of two parts, stopping after the first -
.
Upvotes: 3