rsk82 rsk82 - 8 months ago 51
PHP Question

What is the Quickest Way to Check If All Values in an Array Are Numeric?

I must check big arrays to see if they are 100% filled with numeric values.
The only way that comes to my mind is foreach and then is_numeric for every value, but is that the fastest way?


assuming your array is one-dimensional and just made up of integers:

return ctype_digit(implode('',$array));