Extract Numbers from String

Extract all numbers from a string.

Code

General
preg_match_all('/\d+/', $str, $matches);
return array_map('intval', $matches[0]);

Parameters

The string to extract numbers from

Server

More PHP Snippets