i want to single quote inside the string. for example

$strString = "i'm girl";

when i echo out the string, it's like this :

i\'m girl //output

i want the string like "i'm girl".

i try to use stripslashes. something like below

$strString = "i's girl";
$strAfter = stripslaches($strString);
echo "<br>after strip : ". $strAfter;

But the output still is the same.. Can anybody help me??

    try stripslashes, not stripslaches.

      sorry ... i am using stripslashes($strString);

        Could you try something like this?

        <?php
        $str = "I\'m a girl";

        $str = str_replace("\'","'",$str);

        echo $str;
        ?>

          essentially the same thing stripslashes does, only in more code...

            Originally posted by LordShryku
            essentially the same thing stripslashes does, only in more code...

            So I suppose it has no chance of producing different results?

            What would cause the slashes to show up in the first place?

              why i can't use stripslashes, instead of using str_replace??

                Originally posted by likchin
                why i can't use stripslashes, instead of using str_replace??

                Escuse me?

                  ok.... thanks everybody... i managed to echo out the result which i want. Using the stripslashes and using the str_replace is showing same result.

                    Originally posted by likchin
                    ok.... thanks everybody... i managed to echo out the result which i want. Using the stripslashes and using the str_replace is showing same result.

                    Alright. Glad you could fix it, even though I didn't help. <_< 😛

                      Originally posted by snap2000
                      So I suppose it has no chance of producing different results?

                      What would cause the slashes to show up in the first place?

                      magic_quotes_gpc causes that. When set on, is terminates all needed characters with slashes by default.

                        I was just working with a deal like this yesterday. There is a thing in PHP called Magic Quotes. What it means is that quotes are automatically escaped with a .

                        When it's replaced is the issue here.

                        If you have magic_quotes_gpc turned on in your ini file, then any time you post a value that has a quote in it, the quote will be escaped.

                        There is another setting, magic_quotes_runtime. According to the manual:

                        If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash.

                        Is it possible that this is why you are getting escaped quotes? The good news is that you can turn off magic_quotes_runtime with the function set_magic_quotes_runtime(0). Give that a try.

                          Thank you for that information. 😃

                          I haven't had a chance to look at every function yet, and it'll take time and use to remember them fully. 😉

                            Write a Reply...