How can I return a value without breaking a loop, The purpose of this is to return the increment value of a for loop to represent "attempts" that I want to return to view, for example read JSON that takes attempts I want to display it visually in view.
Example of what I've tried
for($i =0; $i< 15; $i++){
numOfAttempts($i);
try{
file_get_contents('url')
}catch(){}
}
public function numOfAttempts($i){return $i;} //Return the attempt count to view