Good day! Tell me, please, my brain does not want to work anymore ...

Using ArrayHelper :: map (), I bring my data to the $ hasanArray array

Array ( [N] => 12 [R] => 16 [S] => 21 ) 

The array has exactly this form - infa 100%

Then i try to refer to him

 if ($hasanArray['R'] > $AVG['R'] + $sqr['R']) 

Then get

 Undefined index: R 

Any ideas?

Code:

 $query = 'SELECT pmh.scale, SUM(pht.value) as value FROM psy_hasan_tmp pht JOIN psy_mdl_hasan pmh' . ' ON pmh.question_id = pht.question WHERE pht.userid = :user GROUP BY pht.userid, pmh.scale'; $hasanArray = ArrayHelper::map(MdlPDOResults::findBySql($query, [':user' => $user])->asArray()->all(), 'scale', 'value'); $hasanStr = ''; if ($hasanArray['R'] > $AVG['R'] + $sqr['R']) $hasanStr .= 'V'; elseif ($hasanArray['R'] < $AVG['R'] - $sqr['R']) $hasanStr .= 'N'; else $hasanStr .= 'S'; 
  • @ Alexey Shimansky I have an array with RSN indices and corresponding integer values - CYTOODO ZabKIPKRO
  • then the helper does not work ..... show the full code from the helper, the helper itself and after and the print_r array immediately after the helper is triggered - Alexey Shimansky
  • @ AlekseyShimansky problem is that print_r after the helper displays exactly Array ([N] => 12 [R] => 16 [S] => 21) - CYTOODO ZabKIPKRO
  • What is $ AVG and $ sqr? where do they come from? maybe on R swears on them, but not on $ hasanArray - Alexey Shimansky
  • @ AlekseyShimanskiy value $ AVG Array ([N] => 14.6454 [R] => 18.7265 [S] => 24.8554) And $ sqr Array ([R] => 5.6719146277931 [N] => 6.9858467392703 [S] => 10.058326573039) - CYTOUDO ZabKIPKRO

0