I always got a loop, when I run my code.
This is the code that I tried.
//ARRAY VALUES
$array = array();
$array[] = "201310656";
$array[] = "201310657";
$array[] = "201310658";
$array[] = "201310659";
function check ($array,$search){
//IF FOUND
if (in_array($search, $array)) {
$search = intval($search);
//+1 In Original Value If Found
$search += 1;
recheck($array,$search);
return $unique_value;
}
//IF NOTFOUND RETURN ORIGINAL INPUT
else{
return $search;
}
}
$unique_value = check($array,"201310659");
The results I wanted to attain is if the value exists recheck the array until output the unique value.