Php Find Index In Array Javascript Length Of List