Help with preg_replace

Started on the old forum in August 2012 · view the original in the archive · old links redirect here

2 replies · 453 views · started 14 years ago · 1 min read

2 participants
s3nzo Developer · 156 posts #1

Guys may u please help me here

function myFunction($var)
{
$x = preg_replace('/&\#([0-9]+);/', html_entity_decode('&#$1;'), $var);
return $x;
}

But if I parse myFunction('ά') for example it returns ά as is

softwarefreak Senior · 349 posts #2

s3nzo wrote: Guys may u please help me here

function myFunction($var)
{
$x = preg_replace('/&\#([0-9]+);/', html_entity_decode('&#$1;'), $var);
return $x;
}

But if I parse myFunction('ά') for example it returns ά as is

The function html_entity_decode is not getting parsed at dat place I believe (tried replacing html_entity_decode with md5)

<?
function myFunction($var) 
{ 
$x = preg_replace('/&\#([0-9]{2,4});/', '&#$1;', $var); 
return html_entity_decode($x); 
}
echo myFunction("k");

It's kinda strange (😊')

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

s3nzo Developer · 156 posts #3

Thanks bro, it seems my problem was a bit more complicated than that, i was matching characters

'&#([0-9]+);' instead of '&#([0-9]+);'

i realized that when i accessed the database directly

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close