$id = ' 0 ';
$arr =array (' a.jpg ', ' b.jpg ', ' c.jpg ');
echo "' {$arr [$id]} ';
Echo ' <br> ';
Echo ' {$arr [$id]} "';
Out
' C.jpg '
"{$arr [$id]}"
Reason
The fields inside the double quotation mark are interpreted by the compiler and then output as HTML code.
' No explanations in single quotes, direct output
1. The value of the string is enclosed in quotation marks
Use single quotes as much as possible in 2.PHP, with double quotes in all HTML code
3. When you include variables, use double quotation marks to simplify the operation
4. In complex cases, wrap them in curly braces.
PHP quotes also have a use, sometimes need to generate text files in PHP, newline character \ n need to use double quotation marks in order to work, single quotation marks will be directly to the character output.
Reference:
Http://www.cnblogs.com/llsun/archive/2012/07/16/2593027.html
PHP single quotes, double quotes