How to use addcslashes in PHP

In this article, I will explain how the addcslashes() function can be used in PHP.
  • 1887
addcslashes() function in PHP
  • The addcslashes() function is used to return a string with backslashes before of the specified characters in a string.
  • In PHP predefine escape sequences
    • \o it is represent the Null.
    • \r it is represent the carriage return.
    • \n it is represent the newline.
    • \f it is represent the form feed.
    • \v it is represent the vertical tab.
    • \t it is represent the tab.




  • string string is required parameter. string is determine check to string.
  • characters character is required parameter. it is Sequence of characters.


The following example show to how the addcslashes() function can be used in PHP.



<h3 style="color: green;">addcslashes() function example in PHP</h3>


    echo addcslashes('c-sharpcorner', '-');

    echo '<br>';

    echo addcslashes('c-sharpcorner.', '.');

    echo '<br>';

    echo addcslashes('Welcome to c-sharpcorner','t');

    echo '<br>';

    echo addcslashes('Welcome to c-sharpcorner','A..Z');

    echo '<br>';






You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2019 DotNetHeaven. All rights reserved.