I am facing some weird issue with the following code:
for($i=0;$i<count($job1);$i++){
for($j=0;$j<count($jobidcomm);$j++){
if(!$jobidcomm->isEmpty() && $job1[$i]->job_pos_id==$jobidcomm[$j]->job_id){
$job[$i]=$job1[$i];
break;
}
else if (!$recruiter==null)
{
if(!$job1[$i]->commission_percentage==null){
$newamt=(($job1[$i]->min_sal*$job1[$i]->commission_percentage)/100)*($recruiter/100);
}
else{
$newamt=($job1[$i]->commission_flat_amt)*($recruiter/100);
}
$job1[$i]->commissionHalfAmt=$newamt; //here is i m having problem(this is temprory assign data)
$job[$i]=$job1[$i];
}
}
}
suppose at j=0
it executes $recruiter
condition where I assign a temp value but when j
becomes 1 (i.e j=1
), then it goes inside this
if(!$jobidcomm->isEmpty() && $job1[$i]->job_pos_id==$jobidcomm[$j]->job_id)
above condition, in this condition I want to reset job1
as it originally was(like before without temp assigned data)