im trying to make a reference to a multidimentional array columns, and i need to make an $i ammount of references to the array values as string. for example 1st row:
for ($i=0; $i<count($array[0][column[$i]]);$i++)
{
$value_1 = &$array[0][column[$i]];
}
is there a way to name the "$value_x" variable with $i identificator? similar to echo "$value_$i";
im lacking experience with references, any advise would be appreciated.
You can set multiple variables with a name based on the loop index with ${"value_$i"}
:
<?php
for ($i=0; $i<10;$i++)
{
${"value_$i"} = &$array[0][column[$i]];
}
I've created a working example showcasing this here :)