You are not allowed to put a PHP array directly to JavaScript.
Please try to json_encode it:
onclick='mostrarModal(".$idboton.",".json_encode($arraynombres).");'
Regarding your JavaScript I would suggest to directly use eventos
instead of copying the elements to array
:
for(var i =0; i < eventos.length;i++) {
acumuladordenombres = acumuladordenombres +' '+ eventos[i][0];
}
solved TypeError: array[i] is undefined