How to make a conclusion one of the rows on the page?

Hello. How to make the page output a single proxy from the list:
87.98.190.149:3128
47.88.189.216:3128
203.232.91.168:3128
200.54.180.226:80
23.97.59.143:3128
212.174.135.241:3128
62.247.0.25:8080
And every time you refresh the page is displayed the following line?
July 4th 19 at 23:43
2 answers
July 4th 19 at 23:45
Solution
can something like this:

session_start();
$arr = [
'87.98.190.149:3128',
'47.88.189.216:3128',
'203.232.91.168:3128',
'200.54.180.226:80',
'23.97.59.143:3128',
'212.174.135.241:3128',
'62.247.0.25:8080'
];

$count = isset($_SESSION['count']) ? $_SESSION['count'] : 0;
$total = sizeof($arr) - 1;

if($count > $total) $count = 0;

echo $arr[$count];

$count++;

$_SESSION['count'] = $count;
And how to do so instead
$arr = [
'87.98.190.149:3128',
'47.88.189.216:3128',
'203.232.91.168:3128',
'200.54.180.226:80',
'23.97.59.143:3128',
'212.174.135.241:3128',
'62.247.0.25:8080'
];
Was the file with the proxy list? - devonte_Labadie commented on July 4th 19 at 23:48
To open the file and read it into an array line by line. - boris_Bernhard commented on July 4th 19 at 23:51
July 4th 19 at 23:47
The most simple:
Addresses are placed in the array. Started session. Then checks the session for the current element number in the array. If nothing is displayed first. If it is - it increases and then displays the corresponding element of the array. At the end of the session is recorded the current number of the item.
Of course, at the start, if in the array there is no element with this number, you can reset the counter to 0, and show zero element in the same way as if the session wasn't room.

Find more questions by tags PHP