I've got a file I need to read in and get the fifth line of and set to some variable. My perl friend gave me this snippet of code (usually his examples in perl are pretty close to the mark in php) but after reading fopen and popen on php.net, I'm still unclear of how I would do this.
open(STYLEFILE, $siteroot . "/styles");
my $sitestyle = <STYLEFILE>;
my $sitetype = <STYLEFILE>;
my $siteset = <STYLEFILE>;
my $sitesize = <STYLEFILE>;
my $sitestuff= <STYLEFILE>;
close(STYLEFILE);
was his example.
I need to open ../styles, and parse it for line 5 which reads
sitestuff=4 (or some number)
from certain pages in the project I am working on, so I know what "sitestuff" to give them. I know how to use fopen to append to files, how to read in a single line..but I'm just not making the intuitive leap to reading in 4 lines I do nothing with just to get line 5.
any help appreciated.