Require_once "and" "solving ideas

Source: Internet
Author: User
Require_once "and" "
Rt
Both of these methods are right? What's the difference?

------Solution--------------------
"" In the middle of the variable will be interpreted
"Will not

The key is the difference between "and"
------Solution--------------------
Not related to require
------Solution--------------------
No difference, require only requires that the parameter is a real file (string type)
------Solution--------------------
The comrade upstairs said the right, ' and ' in the analysis and does not resolve the difference.
And there is: require (file) you put in any position, he will include files, such as
if (0) {
Require (. php);//This file will be included, but will not execute code.
}
if (0) {
require_once (. php)//is not included and will not be executed.
}
Require_once (); will be before the introduction of the search before the introduction, there is not introduced, not introduced.
------Solution--------------------
I write require_once ' xxx.php '; It's a good one. It's a little faster than "".
------Solution--------------------
discuss

I write require_once ' xxx.php '; It's a good one. It's a little faster than "".

------Solution--------------------
It is true that single quotes are more efficient than double quotes, because the contents of the double quotes are parsed, so a process is slower than single quotes.
$a = ' B ';
Echo ' a$a ';
Will output a$a
and echo "a$a";
will be output
Ab
You can take a look at this post and discuss the difference and efficiency of single and double quotes.
Http://www.phpnewer.com/index.php/Ltqz/detail/id/60
------Solution--------------------
I know it's better to have a single quote in PHP than double quotes.
Require_once "xxx.php" is more than require_once ' xxx.php ' operation, it will check "" There is no variable and ' do not need, he is a string. The same $arr [' name '] is the same as the $arr ["name"].
In specific to Deep said I also forget, you can Baidu a bit.
------Solution--------------------
Can not use double quotation marks as far as possible without using double quotation marks
------Solution--------------------
The difference is

Single quotation marks
The simplest way to define a string is to enclose it in single quotes (punctuation ').

If you want to output a single quotation mark, precede it with a backslash (\). If you want to output a backslash before the single quotation mark or at the end of the string, enter two (\ \). Note that if the backslash is preceded by any other character, the backslash will be output directly.

Note: Unlike double quotes and HEREDOC syntax structures, variables in single-quote strings and special meanings of characters will not be replaced.

Double quotes
If the string is enclosed in double quotation marks ("), PHP will parse some special characters:

Escaped characters Sequence meaning
\ n line break (LF or 0x0A () in ASCII)
\ r Enter (CR or 0x0D () in ASCII)
\ t Horizontal tab (HT or 0x09 (9) in ASCII)
\v tab in vertical direction (VT or 0x0B (one) in ASCII) (since PHP 5.2.5)
\f page Break (FF or 0x0C () in ASCII) (since PHP 5.2.5)
\ \ Backslash
\$ USD Dollar mark
\ "Double quotation marks
\[0-7]{1,3} A string that conforms to the order of the expression is an octal character
\x[0-9a-fa-f]{1,2} A string that conforms to the order of the expression is a hexadecimal character

Like a single-quote string, a backslash is printed if you output a character other than the above. PHP5.1.1 previously, the backslash in the \{$var} was not displayed.

The most important feature of a string defined in double quotation marks is that the variable will be made, and more information can be found in string parsing.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.