php - Retain the last value of the loop -
i have loop want retain last value of variable.
$count = 20; $data_list = 6; $ceil = ceil($count / 6); for($y=0; $y < $ceil; $y++){ $new_x = 0; for($x=$new_x ; $count<20; $x++){ foreach($success_arr $key => val){ if($x < $data_list){ echo $val[$x]; $new_x = $x; $data_list = $data_list + $x; } } } }
is possible retain value of new in next loop? , $data_list
variable?
initialise $new_x = 0;
outside loop.
Comments
Post a Comment