Php Random Array with no dublicates for serial numbers

I’m looking around the forum and can’t get everything together,

here’s what I’m trying to accomplish:

I have a serial.txt file with 1000 serial numbers.

I need to create a script to get a serial number from that file with no repeats.
(it can restart, it does not matter as long as if it will grab 1 serial number and each one will be unique to 1,000)

(Since serial numbers have to be unique to each output.)

In fact, the random part does not matter.

I just need a script to pull a serial number for the .txt file with no repates, whether it be random or not.

I don’t know about the reading the file contents (never done that myself with php) but for getting a random unique serial number, assuming that all the serial numbers in the file are unique, once you’ve got them in an array you could use shuffle() on the array to randomise the order. You’d then use array_pop() to get the last number (which would be taken off the end of the array) and display it and/or do some processing with it as required.

I think I got it, but thanks for the idea!

If you want to make sure there are no duplicates in the array use array_unique() PHP function. PHP: array_unique - Manual