dimanche 10 février 2019

Array getting converted to stdClass on addition

I have two arrays which I want to add under certain conditions which is provided by for loop. But I get the error, "Object of class stdClass could not be converted to number." on the last line.

$reld=DB::table('jp')->select('cp')->get()->toArray();
     //dd($reld);
     for($i=19;$i<=5957;$i++)
     {
       $l=$i-19;
       $fdp[$l]=0;
       $tdp[$l]=0;
       $l=$i-19;
       $cup[$l]=$reld[$i];
       for($j=0;$j<=4;$j++)
       {
         $m=$i-$j;
         $fdp[$l]=$fdp[$l] + $reld[$m];                                                                                 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire