what is difference between addslashes() and addcslashes()

April 11, 2010 | Filed Under PHP | Comments Off

addslashes — Quote string with slashes

Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote (), double quote (), backslash (\) and NUL (the NULL byte).

style="color: #000000;"><?php
$str
= "Is your name O'reilly?";
// Outputs: Is your name O\'reilly?
echo addslashes($str style="color: #007700;">);
?>
addcslashes — Quote string with slashes in a C style

Returns a string with backslashes before characters that are listed in charlist parameter.

<?php
echo addcslashes("zoo['.']", 'z..A');
// output:  \zoo['\.']
?>

Comments

Comments are closed.

© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker