I am quite surprised that in the code below, the first var_dump outputs null while the second outputs the correct value (0.8215). How can I fix this ?
Looking at similar questions, this kind of problem seems to come from either :
-a too old version of php (as in here) but I'm using php 5.6.
-forgetting to put a return in a function (as in here or there), but I do have returns in my functions.
<?php
$ab_coefficients=array(
1=>array( 0.9855 , 0.8678 ),
2=>array( 0.9315 , 0.8215 )
);
function a_coefficient($k) {return($ab_coefficients[$k][0]);}
function b_coefficient($k) {return($ab_coefficients[$k][1]);}
var_dump($ab_coefficients[2][1]);
var_dump(b_coefficient(2));
?>