I have a list of variables which I am using for some PHP functions. I know I can simplify this code but I am not really sure how. I have tried for(){} loops but haven't figured out how to make the result usable.
HERE ARE MY VARIABLES
$saveData_1 = post_data($url_1);
$saveData_2 = post_data($url_2);
$saveData_3 = post_data($url_3);
$saveData_4 = post_data($url_4);
$saveData_5 = post_data($url_5);
$saveData_6 = post_data($url_6);
$saveData_7 = post_data($url_7);
$saveData_8 = post_data($url_8);
$saveData_9 = post_data($url_9);
$saveData_10 = post_data($url_10);
$saveData_11 = post_data($url_11);
$saveData_12 = post_data($url_12);
$saveData_13 = post_data($url_13);
$saveData_14 = post_data($url_14);
$saveData_15 = post_data($url_15);
$saveData_16 = post_data($url_16);
$saveData_17 = post_data($url_17);
$saveData_18 = post_data($url_18);
$saveData_19 = post_data($url_19);
$saveData_20 = post_data($url_20);
HERE IS WHAT I HAVE TRIED
for($i = 0; $i<20; $i++) {
$saveData = '$saveData_'.$i;
$postData = 'post_data($url_'.$i.')';
print($saveData. '=' .$postData. ';');
}
This works for the most part, it prints out my list of variables. But what I don't know, is how to make this usable so instead of printing them to the page being displayed in the browser they will be instead be "printed" to my php script.
Basically my goal is to write the Variables of above without having to actually write a new variable each time.