Help with preg_replace

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with preg_replace

    Guys may u please help me here

    PHP Code:
    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
    libra.wen.ru

    #2
    Originally posted by s3nzo View Post
    Guys may u please help me here

    PHP Code:
    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)
    PHP Code:
    <?
    function myFunction($var) 

    $x = preg_replace('/&\#([0-9]{2,4});/', '&#$1;', $var); 
    return html_entity_decode($x); 
    }
    echo myFunction("k");
    It's kinda strange (')
    Last edited by softwarefreak; 31.08.12, 11:46.
    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

    Comment


      #3
      Thanks bro, it seems my problem was a bit more complicated than that, i was matching characters
      Code:
      '&#([0-9]+);' instead of '&amp;#([0-9]+);'
      i realized that when i accessed the database directly
      libra.wen.ru

      Comment

      Working...
      X