daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand