String Type
a string is simply a sequence of characters treated as a contiguous group.Such groups are
typically delimited by single or double quotes,
String Examples:
as I mentioned a string can be enclosed both in single and double quotation marks,that each will behave diffrently.singly quoted strings are treated literally meaning that if there were any variables inside it ,the name of the variable will be printed instead of the value of it, but double quoted strings will reaturn the value of the variable with printing of sequence of characters near it.
single quoted Strings
Escept some characters, singly quoted strings will read and stroe their characters literary, meaning that if there is a varaible inside the string value, it will print the variable name with dollar sign itself rather than returning its value.
Example
Outputs:
nesting quotations in string
There are Times where you want to have one wod to be emphasized or to isolate a word from the body of your written sentens that will be accomplsihed so by using quotes by as the quotes are in the PHP language structure, How to nest it?
if you want to do so first you must see if you wat the string to be read litterally
and if you want a word inside your sentence to be quoted, the quotation must be vary from the quotation used for the uper leve
forexamlpe if you are using the signle quotation then you should use the double inside for litteral strings
if you are tring to use double qoutation for isolate or emphasise a word then you must use the single quotaton on the uper level
Example:
there is also another way to have both quotes for the variable string and inside of the variabel that could be accomplishde by using the \’ and if you are trying to use double quotes you should use \” inside the string
Example:
Provides:
Related posts: