I would like to display the 'words' in alphabetical order, but all of the examples of solutions that I have come across, are not working for me.
I have tried using the implode() and explode() functions, using the file() function, and then using the sort() function.
Any help is very much appreciated, thank you!
<!DOCTYPE html>
<html>
<head>
<title>words list</title>
</head>
<body>
<h1>Word List</h1>
<?php
@$fp = fopen("words.txt", 'rb');
flock($fp, LOCK_SH); // lock file for reading
while (!feof($fp)) {
$words= fgets($fp);
explode($words, "\n");
file($words);
sort($words);
echo htmlspecialchars($words)."<br />";
}
flock($fp, LOCK_UN); // release read lock
fclose($fp);
?>
</body>
</html>