Currentnextreset function in php. $ Arrayarray (stepone, steptwo, stepthree, stepfour); defines an array echocurrent ($ array ). n; return next ($ array), the first element of the array. the array pointer is followed by a next ($ array) $ array = array ('step one', 'step two ', 'Step three ', 'step four'); // defines an array.
Echo current ($ array )."
N "; // returns the first element of the array.
Next ($ array); // The array pointer moves one bit behind
Next ($ array); // The array pointer moves one bit behind
Echo current ($ array )."
N "; // returns the current element of the array, the third value
Reset ($ array); // pointer to the first value of the array
Echo current ($ array )."
N "; // returns the first value of the array.
//
$ Info = array ('red', 'blue', 'green'); // defines an array.
While ($ result = current ($ info ))
{
Echo $ result;
Echo"
";
Next ($ info );
}
//
$ Array = array (
'Fruit1' => 'apple ',
'Fruit2' => 'Orange ',
'Fruit3' => 'grape ',
'Fruit4' => 'apple ',
'Fruit5' => 'apple'); // defines an array.
While ($ fruit_name = current ($ array) // Obtain the current value of the array cyclically
{
If ($ fruit_name = 'apple') // if the current value is apple
{
Echo key ($ array ).'
'; // Key name of the output current value
}
Next ($ array); // Move the array pointer down one step
}
Iterate (step one, step two, step three, step four); // defines an array echo current ($ array ). n; // return the first element of the array next ($ array); // The array pointer is moved back to the next ($ array )...