Validate associative arrays in PHP