Solution:
Use the file()
function in PHP to split each line of the file into an array then set each element of the array equal to it’s respective variable. For example:
$lines = file('user1.txt');
$firstname = $lines[0];
$lname = $lines[1];
$age = $lines[2];
$gender = $lines[3];