php get only numbers
snippet in php

php get only numbers

user3098

$str = 'In My Cart : 11 items';
$int = (int) filter_var($str, FILTER_SANITIZE_NUMBER_INT);