I am trying to dynamically set the first dimension of a multidimensional array using a value from an ACF input field in Wordpress with the ID of fund_data_id. The array is stored within the variable $fund_array and when manually drilling down to the specific data point I want to access within the array, it works just fine. An example of manually drilling down successfully is: $fund_array[1][5].
Ideally, I'd like to be able to set the first dimension of the array (which is currently [1]) to read the input from the ACF field fund_data_id in Wordpress, which I set to a number value of 1. However, the first dimension of the array isn't recognizing the ACF input from Wordpress. I've tried:
<?php
echo $fund_array[the_field('fund_data_id')][5] ;
?>
and...
<?php
$num = the_field('fund_data_id');
echo $fund_array[$num][5] ;
?>
The second dimension will stay constant, so there's no need to change that one, just the first dimension via an input from an ACF field.
Thanks in advance to everyone for any help or suggestions!