Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP string replace issue

  • 13-05-2005 07:14PM
    #1
    Registered Users, Registered Users 2 Posts: 252 ✭✭


    Hi

    im using

    str_replace("&", "&", $row->text);

    but this even changes the &'s in   to  

    which is not exactly what i want

    I just want to change the &'s . Anyone know can this be done???


    Tnx


Comments

  • Registered Users, Registered Users 2 Posts: 9,448 ✭✭✭RobertFoster


    Generally ampersands are are written in text like & this - with a space before and after, aren't they? Why not try:

    str_replace(" & ", " & ", $row->text);

    Just a thought...though I'm sure someone else will come up with a better solution :o


  • Registered Users, Registered Users 2 Posts: 252 ✭✭ConsultClifford


    Generally ampersands are are written in text like & this - with a space before and after, aren't they? Why not try:

    str_replace(" & ", " & ", $row->text);

    Just a thought...though I'm sure someone else will come up with a better solution :o


    yip thats what i tryed just after posting... seems to be working fine.

    Tnx anyhow!


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    htmlspecialchars() or htmlentities()


Advertisement