fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $string = "There are three ids: id=10 and id=12 and id=100";
  6. preg_match_all("/id=(\d+)/", $string, $matches);
  7. print_r($matches);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => id=10
            [1] => id=12
            [2] => id=100
        )

    [1] => Array
        (
            [0] => 10
            [1] => 12
            [2] => 100
        )

)