Php Check Array Size Javascript Substring Negative Character