Answer the question
In order to leave comments, you need to log in
How to write the first element in an array into a variable, then delete and take the next one?
Hello, I'm not strong in php, I've been suffering for 2 hours already, tell me please. There is such a task, you need to take the first value from an array, for example, 1000 values, write it to a variable and delete it from the array, and take the next one, and so on in a loop until the values in the array become 0. how to do this?
i tried and here is my crooked code
<?php
$n = 3;
while($n >= 1)
{
$array = array("per1", "per2", "per3");
$elmas = $array[$n-1];
echo $elmas;
unset($array[$n-1]);
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question