I have multiple variables created from a form such as : $X1, $X2, $X3
I wish to manipulate these variable for placement into MySQL but would like to stream,line the code to loop for each variable as opposed to rewriting the same instructions.
For example:
Instead of writing:
$Y1=subtr ($X1, 0,5 );
$Y2=subtr ($X2, 0,5 );
$Y3=subtr ($X3, 0,5 );
Would like to perform something like:
for ($i=1, $i<4, $i++)
{$Y($i)=substr ($X($i), 0, 5);}
** Obviously the code above is not correct with $Y($i) but therein is the problem, I know this is coding 101 but I am new to this and any help would be greatly appreciated.