Get support from Xavier Media
It is currently Sun Dec 08, 2013 3:37 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: addcslashes and addslashes
PostPosted: Wed Oct 11, 2006 1:10 pm 

Points:
hiii i want new help
can anyone tell me what the difference between
Quote:
addcslashes(string str,stringchalist);

addslashes (string str);


and why to use this code really i am trying to make this code to see the difference but i am not found any difference so can anyone tell me
Code:
<?
$text = "someinfo";
print ($text);
addslashes ($text);
?>

*********************************************


Report this post
Top
  
Reply with quote  
 Post subject: addslashes and addcslashes
PostPosted: Wed Oct 11, 2006 2:51 pm 

Points:
addcslashes -- Quote string with slashes in a C style

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

addcslashes ( string str, string charlist )

When you define a sequence of characters in the charlist argument make sure that you know what characters come between the characters that you set as the start and end of the range.

[php]<?php
echo addcslashes('foo[ ]', 'A..z');
// output: \f\o\o\[ \]
// All upper and lower-case letters will be escaped
// ... but so will the [\]^_` and any tabs, line
// feeds, carriage returns, etc.
?> [/php]

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

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).

addslashes ( string str )


[php]<?php
$str = "Is your name O'reilly?";

// Outputs: Is your name O\'reilly?
echo addslashes($str);
?> [/php]

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Basically, addslashes() adds slashes to predefined dangerous characters while addcslashes() lets YOU define the characters to add slashes too.

Get it? :-D


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]