Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

php preg_replace()

  • 24-06-2007 12:52pm
    #1
    Registered Users, Registered Users 2 Posts: 673 ✭✭✭


    Hi,

    Im having problems with this piece of code. I need it to replace special characters with "". It is doing it for the first 5 $punc variables listed below but it does remove the $ for some reason. Anyone have an idea why its not working for this character?

    Thanks

    [PHP]
    //insert the article slug
    $my_listing_url=strtolower($business_name); // transform to lowercase
    $punc[0]="/!/";
    $punc[1]="/\"/";
    $punc[2]="/£/";
    $punc[3]="/'/";
    $punc[4]="/€/";
    $punc[5]="/\$/";

    // add any punctuation marks likely to be used in your title

    $my_listing_url=preg_replace($punc,"",$my_listing_url);

    // replace all instances of any punctuation found in the $punc array with ""
    [/PHP]


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    try this
    $punc[5]="/\\$/"; 
    


  • Registered Users, Registered Users 2 Posts: 673 ✭✭✭Bananna man


    YAY!! :D Finally.

    Thats been giving me a headache for damned ages now. Thanks m8


Advertisement