In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable..
Because strings are a sequence of characters, we can usually select them in the same way we can select elements from an array. For example:
myString = 'Hello World' print(mystring) # this program would output the letter l (L) .
Here we encounter some different syntax rules. Programming languages defineGive the precise meaning of a word, phrase, concept or physical quantity. strings differently. Please do pay attention to the quotation marks, double quotation marks, and triple quotation marks.
Please click the following link to read the official PHP page regarding single quotes, double quotes, heredoc sytnax and nowdoc syntax
<?php $myString = "Hello World"; ?>
- Single quotes: 'allows embedded "double" quotes'
- Double quotes: "allows embedded 'single' quotes".
- Triple quoted: Three single quotes, """Three double quotes"""
Triple quoted strings may span multiple lines - all associated whitespace will be included in the string literal.
myString = 'Hello World'
- The use of double quotation marks allows you to use single quotation marks without having to escape them.
- The use of single quotation marks allows you to use double quotation marks without having to escape them.
Please see the example below :
alert('Say "Hello"'); alert("Say 'Hello'");
var myString = "Hello World";
Do you understand this?
- DefineGive the precise meaning of a word, phrase, concept or physical quantity. the terms: variable, constant, operator, object.