How to Strip Slashes With PHP

The PHP programming language has a large number of built in functions that help programmers by reducing the need to write basic or repetitive code. One such function will remove the backslashes from a string. Backslashes can be inadvertently added to strings that contain quotation marks, so this is useful for removing slashes before displaying or storing the string.

Instructions

    • 1

      Open your PHP program in your editor of choice.

    • 2

      Select the string variable that you want to strip the slashes from, such as "$slashString."

    • 3

      Create a new variable ("$noSlashes") that is the same as the "$slashString" variable, but has its slashes removed, by typing the following: $noSlashes=stripslashes($slashString);.

Related Searches:

References

Comments

Related Ads

Featured