|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-18 16:07 UTC] tony2001@php.net
[2007-05-26 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 20:00:01 2025 UTC |
Description: ------------ When I use preg_replace() with e modifier along with str_replace in the replace string, it doesn't work well. Reproduce code: --------------- HTML code ($s): <ul style="list-style-type: square;"> <li>Megadeth -- Back to the Start, Peace Sells, Rust In Peace, Countdown to Extinction </li><li>Ramones -- Anthology, Ramonesmania, Rocket to Russia, Too Tough To Die, Adios Amigos </li> </ul> $de = array('<li>', '</li>'); $s = preg_replace("#\<ul style\="list-style-type\: square;"\>(.+?)\</ul\>#sie", "'<ul style="list-style-type: square;">'.str_replace(\"$de\", '', '$1').'</ul>'", $s); Expected result: ---------------- I expect that all <li> and </li> get removed in the HTML part ($s). HOWEVER, when I turn $de to a string, so it contains <li> *or* </li>, then it works. Actual result: -------------- <li> and </li> tags don't get removed. This is also explained here (if it helps): http://forum-grounds.com/viewtopic.php?p=756