3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "Hello! 123 test this? 456. done? 100%"; $int = intval(preg_replace('/[^0-9]+/', '', $string), 10); echo $int; $str = 'In My Cart : 11 12 items'; preg_match_all('!\d+!', $str, $matches); print_r($matches); print_r(array_sum($matches));
based on 5sSU8
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
123456100Array ( [0] => Array ( [0] => 11 [1] => 12 ) ) 0