I came from Perl to PHP as well. The foreach() statement works a little differently.
$oldf = file(file.txt);
foreach ($oldf as $line) {
... #do something with it
}
In PHP you use "array as variable" instead of "variable (array)".
On another note, that code you used to open the file into an array can be done with the file() function. And arrays in PHP use the the scalar symbol just like variables.