Previous | Home | Next |
<html> <head> <title>Return the current element in an array</title> </head> <body> <?php $city = array("Allahabad", "Kanpur", "NewDelhi"); print_r($city ); $city = current($city ); // returns "Allahabad" echo "City:$city<br />"; $city = next($city); // returns "Kanpur" echo "City: $city<br />"; $city = prev($city); // returns "NewDelhi" echo "City: $city<br />"; ?> </body> </html>
Output:
Previous | Home | Next |