I am trying to get the ID from a URL string.

I'm trying with the following code:-

FROM:

```
<url>http://www.monkeys.com/monkey.php?id=24</url>

```

I want to get '24' with:-

```
$ID = preg_replace($url, '/^<url>.*\?id=(.*)<\/url>$/', '\1');

```

Any help would be much appreciated - i'm sure this is a regular problem, but I find regex baffling.