Jump to: navigation, search

Php next

From w3cyberlearnings

Contents

PHP function next

This function moves to the next array element.

Syntax next

  • array: array input
next(array);

Example 1

<?php

$array = array(
	 'Semester 1',
	 'Semester 2',
	 'Semester 3',
	 'Semester 4',
	 'Semester 5',
	 'Semester 6',
	 'Semester 7',
	 'Semester 8'
);

// skip two semesters
next($array); // 
next($array); // 

echo current($array) . "<br/>"; // semester 3
// skip three semesters
next($array); //
next($array); //
next($array); //

echo current($array) . "<br/>"; // semester 6
?>

Output

Semester 3
Semester 6

Related Links


Navigation
Web
SQL
MISC
References