Good day. I need your help, the second day I sit on the task.

The essence of what:

There is a file (let's call it list.php) that receives data through $_GET (site.ru/list.php?set=name1,name2,name3 .....) The number of name different every time.

Then in list.php through explode stuff the data into an array. After that, I loop through the array element by element, call the server, get a special key from the server (of the form DFG3egfsG34dsfW , each element will have its own) and write the resulting keys into a new array ll .

And in the end I need to form a new address with these keys separated by commas. (site.ru/load.php?id=id1,id2,id3,id4 ....)

Earlier, when I needed strictly 5 keys, I did it and everything worked

$load = $link.$ll[0].",".$ll[1].",".$ll[2].",".$ll[3].",".$ll[4];

But since now I am getting an unspecified amount of data (from 5 to 100 ...) this does not work.

It is necessary to make a function that will be to the number of keys in the array count(ll) , to form a link with the same number ll[]

In simple words, if I get 5 values, then the variable should be

$load = $link.$ll[0],$ll[1],$ll[2],$ll[3],$ll[4],$ll[5]

if 3 values, then:

$load = $link.$ll[0],$ll[1],$ll[2],$ll[3]

If 100 values ​​then ....

I would be very grateful for any help!

    1 answer 1

     $load = $link . implode(',', $all); 

    implode documentation

    • Everything turned out to be much easier than I thought. - Vladimir V.