Php Find Index Of Element In Array Javascript Mdn For Loop