~snip
Good job man! You're fast.
What system/PHP version are you running?
I tried running on my local system. When you pull merit.all.txt, is it showing spaces for you, or tabs? For me, locally, it's showing tabs, so the top had to be changed to the following.
$url = "http://loyce.club/Merit/merit.all.txt";
$file = file($url);
$file = str_replace("\t", ",", $file);
$file = str_replace("\r\n", "",$file);
I'm not sure why there's a difference, perhaps it's environmental. But, I'd maybe switch to a regex to permit both spaces/tabs just in case.
Also, the return null; within the functions aren't allowing the table to be finished semantically (no ), so I'd drop those, or move the echo up.
For todos, it's probably a good idea to accept no parameters as well, combining the script to allow the user to specify a output method (JSON, or table format)
I can help out providing modifications to your code, but I wanna grab your permission first. Your code after all.
Good job though, and thanks!
Hi, thanks for you inputs.
As I said: It's been a while since I actively coded a lot.
Of course you can use and modify this code. Feel free.
For me it is tabs aswell, but it works like a charme (win xamp v3.2.2. w/ std ini's).
regex are far better! I am just suffering from forgotten knowledge and lazyness. (see above: it has been a while
)
Return and Echo is obv incorrect and has to be changed.
Parameters: I was not sure what was exactly needed. So I made just two versions. But afterall a good idea to just add another bool for JSON output or not, or something like this. Also I initially wanted to work with switch() and parse the whole array as a default.
Holy grail would be a read-only database access to the effected tables. Would be much faster and easier.
Cheers!