php quick question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    php quick question

    i'm trying to replace the character "?" with "-" from $string using

    $result=eregi_replace("?","-",$string");

    but the result is a null array..
    what i'm doing wrong?

    thanks
  • DigitalPimp
    Confirmed User
    • Jun 2003
    • 512

    #2
    don't need the last quote, also try str_replace instead
    Last edited by DigitalPimp; 12-05-2007, 12:41 PM.

    Comment

    • alex79
      Confirmed User
      • Jun 2002
      • 996

      #3
      Originally posted by DigitalPimp
      don't need the last quote
      yes.. without last quote.. but how do i "escape" the ? character?

      Comment

      • Bro Media - BANNED FOR LIFE
        MOBILE PORN: IMOBILEPORN
        • Jan 2004
        • 16502

        #4
        $result = str_replace("?", "-", $string);

        Comment

        • alex79
          Confirmed User
          • Jun 2002
          • 996

          #5
          Originally posted by Jaysin
          $result = str_replace("?", "-", $string);
          this is working..thank you

          Comment

          • DigitalPimp
            Confirmed User
            • Jun 2003
            • 512

            #6
            for future reference, you can escape characters with special meaning like a ? by putting a \ before them but when you use str_replace instead of eregi_replace it will not give special meaning to the ? so you don't need to escape it.

            Comment

            Working...