Versatile array validation for PHP