3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = 'In My Cart : 11 12 items'; preg_match_all('!\d+!', $str, $matches); print_r($matches); unset($matches); $numbers = preg_match("/(\d+)/", $str, $matches) ? (int)$matches[1] : NULL ; print_r($numbers); unset($matches);
based on OI5eE
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 11 [1] => 12 ) ) 11