Php Gen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,
I am just starting out with regex (and classes) so am
not sure how to do this...
I am seeing if a HTML file exists, if yes, I am using
file_get_contents to get the entire HTML file into a
string.
In the HTML file I already have this:
!-- Start header --
html
body
whatever you want comes here
!-- End header --
How do I use a regex to span these multiple lines and
simply cut everything (including the start..end
part)from !-- Start header -- to !-- End header --
Second question:
I am using file_get_contents, is it better to use this
than file() or fread() ?
Thanks,
Mag
Hi,
I can't answer your regexp question but some thoughts on file() etc.:
- file() returns the contents line by line as an array, so this makes only
sense if you need the contents in this form, e.g. for looping through each
line and applying a function or whatever
- fread() requires a file handle that you have to create with fopen(), so
file_get_contents() is kind of a shortcut for fopen()/fread()
Hope this helps.
Regards, Torsten Roehr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php