Guest User

Untitled

a guest
Dec 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2.  
  3. preg_match_all('<(?P<key>\w+)\:(?P<value>\d+)>', 'foo:23,bar:42', $matches);
  4. var_dump($matches);
  5.  
  6. array(5) {
  7. [0]=>
  8. array(2) {
  9. [0]=>
  10. string(6) "foo:23"
  11. [1]=>
  12. string(6) "bar:42"
  13. }
  14. ["key"]=>
  15. array(2) {
  16. [0]=>
  17. string(3) "foo"
  18. [1]=>
  19. string(3) "bar"
  20. }
  21. [1]=>
  22. array(2) {
  23. [0]=>
  24. string(3) "foo"
  25. [1]=>
  26. string(3) "bar"
  27. }
  28. ["value"]=>
  29. array(2) {
  30. [0]=>
  31. string(2) "23"
  32. [1]=>
  33. string(2) "42"
  34. }
  35. [2]=>
  36. array(2) {
  37. [0]=>
  38. string(2) "23"
  39. [1]=>
  40. string(2) "42"
  41. }
  42. }
Add Comment
Please, Sign In to add comment