$array = array(5, 5.2, "456", "564-223", "5.2", "673"); foreach($array as $item) { if(ctype_digit((string)$item)) { echo "int: ".$item."\n"; } else { echo "not int: ".$item."\n"; } }
No comments:
Post a Comment