What Are the Special Characters You Need
to Escape in Single-Quoted Stings?
There are two special characters you need to escape in a single-quote
string: the single quote (') and the back slash (\). Here is a PHP
script example of single-quoted strings:<?php
echo 'Hello world!';
echo 'It\'s Friday!';
echo '\\ represents an operator.';
?>
This script will print:1.Hello world!It's Friday!\ represents an operator. .
Hello world!It\'s Friday!\ represents an operator.
2.Hello world!It's Friday!\\ represents an operator
Hello world!It/'s Friday!/represents an operator.
|
2.Can You Specify the "new line"
Character in Single-Quoted Strings?
<?php echo '\n will work or not work in single quoted strings.';
?>
This script will print:1.\n will work or not work in single quoted strings. 2. print new line will work or not work in single quoted strings. |
3.What
Are the Special Characters You Need to Escape in Double-Quoted Stings?
<?php
echo "Hello world!";
?>
This script will print:1.echo "Tom said: \"Who's there?\"";
echo "\\ represents an operator.";
4.How
Many Escape Sequences Are Recognized in Double-Quoted Strings?
|
5.How
To Include Variables in Double-Quoted Strings?
1.echo "part 1 $variable part 2\n";
2.echo "part 1 ".$variable." part 2\n";
3. 1 and 2
|
6.How to
Concatenate Two Strings Together?
|
Your Score: |
If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!
0 comments:
Have any question? Feel Free To Post Below: