Login Latest Snippets Home My Account
Snippee! A personal code snippet manager... Store, share, organize! ...

parseInt()

Published: 2011-08-11 18:36:53 - In: PHP

Just like the javascript one, only server side!

function parseInt($string) {
//	return intval($string);
	if(preg_match('/(\d+)/', $string, $array)) {
		return $array[1];
	} else {
		return 0;
	}
}