note 30911 deleted from function.ereg by kennyt

From: Date: Wed, 26 Jan 2005 03:48:53 +0000
Subject: note 30911 deleted from function.ereg by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83968@lists.php.net to get a copy of this message
Note Submitter: TY@nospam dot com ---- reply to kawzaki. most probably its because of the newlines in the code. ive got a solution after sometime and here it is(although there is definitely another easier way this one works as well) $string = " "; $fp = fopen("file.php","r+"); while (!feof($fp)) { $stuff = fread($fp,1024); $thing = str_replace($string, "", $previous_stuff . $stuff); $previous_stuff = $thing; } if (ereg("^(.*)(<body>)(.*)(<\/body>)(.*)$", $thing, $matches)) { print $matches[3]; } $matches[3] will return the code of the parts between <body> and the </body> tag although it will be be stripped of all newlines.i would also like to thank my friend for giving the starting idea.

« previous php.notes (#83968) next »