Beginner Friendly · Hands-on · Free

PHP String functions | How to add slashes in the given string php tamil

addslashes() function நாம் கொடுக்கும் string-ல் single quote (') , double quote (") , backslash (\) மற்றும் NUL (the NUL byte) வந்தால் அந்த character-களுக்கு முன்னால் backwardslases(\) add செய்கிறது.

5 min read Updated Jan 09, 2026

addslashes() Function in PHP

addslashes() function நாம் கொடுக்கும் string-ல் single quote (') , double quote (") , backslash (\) மற்றும் NUL (the NUL byte) வந்தால் அந்த character-களுக்கு முன்னால் backwardslases(\) add செய்கிறது.

addslashes ( $string ) ;

Note: addslashes() function-ல் string argument-ஆக அனுபப்படுகிறது. இங்கு நாம் கொடுக்கும் string-ல் single quote (') , double quote (") , backslash (\) மற்றும் NUL (the NUL byte) வந்தால் அந்த character-களுக்கு முன்னால் backwardslases(\) add செய்கிறது.

Example1

<?php
$input = 'He said, "Great!"';
echo addslashes($input);  
?>

மேலே உள்ள Example1-ஐ கவனிக்கவும் addslashes() என்ற function-இல் $input என்ற variable-இல் 'He said, "Great!"' என்ற string argument-ஆக அனுப்பப்பட்டுள்ளது. இங்கு "Great!" என்ற string-இல் double quote (") உள்ள character-களுக்கு முன்னால் addslashes() function backwardslases(\) -ஐ add செய்கிறது.

Output:

He said, \"Great!\"

Example2

<?php
$str = "Let's try this";
echo addslashes($str);  
?>

மேலே உள்ள Example2-ஐ கவனிக்கவும் addslashes() என்ற function-இல் $str என்ற variable-இல் "Let's try this" என்ற string argument-ஆக அனுப்பப்பட்டுள்ளது. இங்கு Let's என்ற string-இல் single quote (') உள்ள character-க்கு முன்னால் addslashes() function backwardslases(\) -ஐ add செய்கிறது.

Output:

Let\'s try this

இது பற்றிய தங்களின் கருத்துகளை இங்கே பதிவிடுங்கள் . இது பயனுள்ளதாக விரும்பினால் மற்றவர்களுக்கும் இதை share செய்யுங்கள்.