addcslashes — Quote string with slashes in a C style

  1. <html>  
  2.  <body>  
  3. style=”color: #0000bb;”><?php
  4. addcslashes(‘foo[ ]’, ‘A..z’);
  5. // output: \f\o\o\[ \]
  6. // All upper and lower-case letters will be escaped
  7. // … but so will the [\]^_` and any tabs, line
  8. // feeds, carriage returns, etc.
  9. style=”color: #0000bb;”>?>
  10. <?php
  11. echo addcslashes(“zoo[‘.’]”, ‘z..A’);
  12. // output: \zoo[‘\.’]
  13. ?>
  14.  </body>   
  15. </html>  
eXTReMe Tracker