Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- preg_match_all('<(?P<key>\w+)\:(?P<value>\d+)>', 'foo:23,bar:42', $matches);
- var_dump($matches);
- array(5) {
- [0]=>
- array(2) {
- [0]=>
- string(6) "foo:23"
- [1]=>
- string(6) "bar:42"
- }
- ["key"]=>
- array(2) {
- [0]=>
- string(3) "foo"
- [1]=>
- string(3) "bar"
- }
- [1]=>
- array(2) {
- [0]=>
- string(3) "foo"
- [1]=>
- string(3) "bar"
- }
- ["value"]=>
- array(2) {
- [0]=>
- string(2) "23"
- [1]=>
- string(2) "42"
- }
- [2]=>
- array(2) {
- [0]=>
- string(2) "23"
- [1]=>
- string(2) "42"
- }
- }
Add Comment
Please, Sign In to add comment