read part of .txt file to an array and assign the other part to a value

I am working on a php script and need help with reading from a .txt file.
Example of format of .txt file
Jane 59.5
Joe 79.5
Billy 23.5
Bob 69.5
Karen 35.2
Debbie 85.6

So from this text file I need to make an array of the names only.
Also from this text file I need to assign the numbers to a $value in order to multiple each number by a set value of 100.

I know how to open the file and set it to read and to close the file and how to echo if the file is not found but anything else i’m completely lost. :-\ :-\ :-\ :-\ :-\ :-\ :-\ :-\ :-\ :o :o :o :o :o :o :o

Someone please help

read the file using get_contents_file() or file(), then explode the contents on \n, then explode the contents of that array on a space, now you have 2 arrays, one is the name, the other is the number, use a loop to do your multiplication.

Sponsor our Newsletter | Privacy Policy | Terms of Service