Hi LaserLight,
Yesterday the code seemed to work fine, but when tested in a larger enviornment with a longer dataserie, I proved useless....
Why ? Beacuse it will match even though the position is right as long as the price info matches...
foreach ($arrayNL3 as $bottomposition)
########## Running a second loop
{
if ($bottomposition > $value2 && $bottomposition < $next2)
{
$mec2 = $Source[$bottomposition];
$j=min( $j , $mec2);
$key2 = array_search($j, $Source);
$j2 = end($arrayMN3);
}
########### Ending second loop
}
if($mec2){
The problem in this code is this part
$key2 = array_search($j, $Source);
It flips the price found back to its position ( which I need it to do...)
The problem is that the position doesn't allways match as there may be many prices that are the same...
Thinking that $bottomposition holds the correct value, (which it does in the loop) it must be possible to use this as a reference somehow...
The price selected in
$mec2 = $Source[$bottomposition]; // just finding the price attached based on the bottomposition extracted in the loop
$j=min( $j , $mec2); // selecting the lowest pricealternative
Has to be from one of the $bottompositions that are brought in the loop...
So matching/search should have been done against these values and not the intire $source string...
But I'm puzzled and stucked...
Regs