Basically I have to move a position of the array (the position 0 to 1, the 1 to the 2, so on until the last position that moves to the first) Example: Array = 1/5/7/9/14/12 Change of position = 12/1/5/7/9/14 The variable $ num, I use to know the number of positions that the array will have.
<?php
$num=$_POST['num'];
echo 'Contenido del array: ';
for($i=0;$i<$num;$i++){
$numeros[]=rand(0,100);
echo $numeros[$i].' | ';
}
echo "<br> <br>";
$ultimo=$numeros[$num-1];
echo 'Nuestro array rotado: ';
for($i=0;$i<$num-1;$i++){
$numeros[0]=$ultimo;
echo $numeros[$i]=$numeros[$i].' | ';
}
echo "<br> <br>";
?>