0
usort($qus_with_ans, "qus_sort");
$ary_val = max(array_column($qus_with_ans, 'updated_at'));
$ary_key = array_search($ary_val, array_column($qus_with_ans, 'updated_at'));
$k = $qus_with_ans[$ary_key];
$curnt_sub_id = $k['subject_id'];
$curnt_sub_name = $k['s_name'];
$last_question_key = end(array_keys($qus_with_ans));

We have a error Strict standards: Only variables should be passed by reference on last line of code i can't understand why error comes Please fix my issue line no. 138 are $last_question_key = end(array_keys($qus_with_ans));

ravi topa
  • 1
  • 3

1 Answers1

0

You can't use function return in end function and should convert it to the variable.

$keys=array_keys($qus_with_ans);
$last_question_key = end($keys);

However, use arrya_pop which is pushing-out last element from the array

$last_question_key = array_pop(array_keys($qus_with_ans));

If you anyway don't have intension to use keys elsewhere from performance point of view.

Oleg Butuzov
  • 4,795
  • 2
  • 24
  • 33