Php Parse String Into Arraylist Length Function Javascript