I have 3 arrays:
$nombres = array("Pepe", "Carlos", "Jesús", "Lola", "Rosa", "Maria");
$apellidos1 = array("Martin", "Lopez", "Salas", "Mateo", "Abas", "De Diego");
$apellidos2 = array("Quesada", "Alcala", "Marín", "Suarez", "Cobos","Rios");
and I want to create a third party that mixes names and names randomly, I tried to put the function mt_rand
in the indexes but I do not do well, I have not achieved with functions that make this type of mixtures. It does not throw me an error, but the array shows me:
Random name 3rd random surname 0 second random last name 5
My current code:
<?php
$nombres = array("Pepe", "Carlos", "Jesús", "Lola", "Rosa", "Maria");
$apellidos1 = array("Martin", "Lopez", "Salas", "Mateo", "Abas", "De Diego");
$apellidos2 = array("Quesada", "Alcala", "Marín", "Suarez", "Cobos","Rios");
$randn = array_rand($nombres,5);
$radn2 = array_rand($apellidos1,5);
$rand3 = array_rand($apellidos2,5);
echo "Nombre aleatorio ". $randn[mt_rand(0,5)]. "apellido aleatorio ".$radn2[mt_rand(0,5)]."segundo apellido aleatorio ".$rand3[mt_rand(0,5)];
?>