Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Following is my code and i want to get next cat_id and current cat_id from the result array
foreach ($test_data as $key) 
{ 	
	$current=$key->subcategory_id;
}


What I have tried:

foreach ($test_data as $key) 
{ 	
	$current=$key->subcategory_id;
	$next=next($key->subcategory_id);
}
Posted
Updated 20-Mar-18 7:18am

1 solution

PHP: next - Manual[^]

But you can't use it with foreach - see the while sample near to the bottom of the page...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900