Php Check Array Size Javascript Function Expression