1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Question

Discussion in 'PHP' started by ukmp3, Aug 8, 2005.

  1. #1
    I have lots of errors in the text on my pages where the " ' " character is used and replaced by me server by a diamond with a question mark in it.

    I want to know if I can run a php script to remove all " ' " from the content of the pages or if there is a server setting I should use.
    SEMrush
    thanks
     
    ukmp3, Aug 8, 2005 IP
    SEMrush
  2. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #2
    There are probably several php programmers who can be a whole lot more definitive than I but, I think you need the "/" in front of the " ' " for it to work properly (e.g. " /' "). You might want to look it up for correct coding practice.
     
    North Carolina SEO, Aug 8, 2005 IP
  3. forkqueue

    forkqueue Guest

    Messages:
    401
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Erm, sorry 'North Carolina SEO', but you are just plain wrong :p

    Probably the ' in question isn't a ' at all, but rather another character which may look like ' when using some fonts. Windows/Frontpage are often a culprit here.

    The solution is to replace this character with an actual '. Should yuo be using ' in code, you either need to enclose it in " quotes, or escape it with a \

    HTH
     
    forkqueue, Aug 8, 2005 IP
  4. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #4
    Fork is right...

    this happens a lot when you paste from one program to another that uses a different version of the ' or "

    Usually a good way to determine if you are ok, is if the quotes are vertical or if they are angled or curved. Angled and/or curved quotes = problems.
     
    UndiesHosting, Aug 8, 2005 IP
  5. Connect

    Connect Guest

    Messages:
    191
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Probably the function "str_replace" can help you? Go to php.net to look up more on that function.
     
    Connect, Aug 12, 2005 IP
  6. mck9235

    mck9235 Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, str_replace would work.
    
    <?php
    $originalstring = "Remove the -'s please.";
    $newstring = str_replace("-", "&#45", $originalstring);
    echo $newstring;
    ?>
    
    PHP:
     
    mck9235, Aug 12, 2005 IP