note 30911 added to function.ereg

From: Date: Thu, 03 Apr 2003 03:13:10 +0000
Subject: note 30911 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-46149@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.ereg.php http://master.php.net/manage/user-notes.php?action=edit+30911 http://master.php.net/manage/user-notes.php?action=delete+30911 http://master.php.net/manage/user-notes.php?action=reject+30911

« previous php.notes (#46149) next »