regex - php regular expression...weird behavior -


what's wrong in expression?

echo preg_replace("/condizioni/","ciao","<tr bla vla condizioni"); 

it not return anything...

anyway works when remove "<" char...but don't understand why...is special char, , if i have match literally.

thank you...

it work want (code on ideone). thing echo "<tr bla vla ciao"; in web page cause troubles. have escape html chars.

htmlspecialchars() :

echo htmlspecialchars(preg_replace("/condizioni/","ciao","<tr bla vla condizioni")); 

it echo &lt;tr bla vla ciao.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -