Activity Stream
48,167 MEMBERS
6865 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Member

    Question Php replacing characters !

    hi my database has text with characters like this : "%28" , "%29"

    i guess they are coming instead of the curly braces : "(" , ")"


    i just want to filter these things out.

    "str_replace" function is not working for this characters.

    can somebody give me an alternate method in doing this ???

    thanks.
    softleaks Reviewed by softleaks on . Php replacing characters ! hi my database has text with characters like this : "%28" , "%29" i guess they are coming instead of the curly braces : "(" , ")" i just want to filter these things out. "str_replace" function is not working for this characters. can somebody give me an alternate method in doing this ??? Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Retired NinJa
    Website's:
    loledhard.com
    major problem here is, i cant understand what u want. Otherwise str_replace works fine if u need to replace some text



    You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!

  4.     
    #3
    Member
    i tried with str_replace. It is not working.

    this is my code :

    $a="%282009%29";
    str_replace("%28","",$a);

  5.     
    #4
    Member
    Website's:
    LulzCovers.com LulzTroll.com
    if you are fetching the data from the database and its coming like %28 , %29
    you can use htmlspecialchars_decode
    more: http://www.php.net/manual/en/functio...ars-decode.php

    or try using the strip_tags
    Contact me for Traffic, SEO, WCDDL, Wordpress, IPB related Services or queries.
    Template Designing, PSD to HTML, Wordpress


  6.     
    #5
    Retired NinJa
    Website's:
    loledhard.com
    Quote Originally Posted by softleaks View Post
    i tried with str_replace. It is not working.

    this is my code :

    $a="%282009%29";
    str_replace("%28","",$a);
    have u tried
    str_replace("(","",$a) ?

    maybe, it is saved in html encoded format in DB & retrieved as proper character



    You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!

  7.     
    #6
    Member
    @humour

    i tried that too.

    nothing happened.

    @deAthbLisS

    i tried the htmlspecialchars and it is not working.

    trying strip_tags now....

  8.     
    #7
    Retired NinJa
    Website's:
    loledhard.com
    i guess u forgot to assign the value of replace function back to variable

    $a="%282009%29";
    $a=str_replace("%28","",$a);

    ?



    You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!

  9.     
    #8
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    Yeah its not working because str_replace returns, it doesn't change by reference.

    you need to assign it to a variable.

    Also see urldecode().
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  10.     
    #9
    Member
    ^agree with JmZ. need urldecode() but if you want to use str_replace for them (if you're fussy) use this:

    $str = "%29 lolcat %28";
    echo str_replace(array("%29","%28"), array("\)","\("), $str);

    should do the trick.

    Made by Envee :P

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [VPS] VPS for replacing my Kimsufi 2G dedicated
    By HD-addict in forum Archive
    Replies: 2
    Last Post: 14th May 2012, 01:01 PM
  2. PHP Curl post with non-english characters
    By t3od0r in forum Web Development Area
    Replies: 14
    Last Post: 2nd Mar 2012, 11:19 PM
  3. Help in replacing lines in various files
    By Funny in forum General Discussion
    Replies: 9
    Last Post: 19th Nov 2011, 08:16 PM
  4. Japanese Characters for Wi-Fi
    By bxflow in forum General Discussion
    Replies: 5
    Last Post: 12th Jan 2011, 01:23 AM
  5. Weird Characters MySQL
    By CyberJ37 in forum Server Management
    Replies: 4
    Last Post: 5th May 2009, 07:47 PM

Tags for this Thread

BE SOCIAL