not a few php To improve efficiency tip, It's mentioned that strings use single quotes , Why is that ?

Because in single quotation marks ,php Think it contains a string . And double quotes ,php It detects whether there are variables in it . So if it's a pure string , Double quotes are a waste of testing resources .

A simple example .

$a = 21;
$test = 'aa$a';
$test1 = "aa$a"; echo $test;// aa$a echo $test1;// aa21

Why suggest php More about using single quotes instead of double quotes for Strings

  1. ( Reprint ) js Replace single quotes with double quotes , Replace double quotation marks with single quotation marks operation

    introduction : Just started to use js There are many problems , I can't understand , Why replacing single quotes requires /g, Now know /g It's all matches in regularization original text :http://blog.csdn.net/joyhen/article/details/43 ...

  2. 2、php The difference between single quotation mark and double quotation mark in string

    The main difference between using single quotation marks and double quotation marks is : Variables and escape sequences in a string defined by single quotation marks are not replaced by the values of variables , Using the variable name in double quotation marks displays the value of the variable .

  3. java Replace single quotation marks in a string with double quotation marks in

    String regexp = "\'";String str = "'good'";System.out.println(" Before replacement :" + ...

  4. PHP The difference between single quotation marks and double quotation marks when defining strings

    Generally, single quotation marks or double quotation marks are used to identify a string . Single quotation string and double quotation string , stay PHP The treatment in is different . The contents in double quotation marks can be interpreted and replaced , The contents of a single quote string are treated as normal characters . for example : $str=6; echo " ...

  5. python String composition MySql On command , The string contains single quotation marks or double quotation marks, which causes errors. Solutions

    Quote from :https://blog.csdn.net/zhaoya_huangqing/article/details/48036839 One . In the composition of SQL Statement and send the command exactly according to Python To pass on the style of Chinese ...

  6. SQL Single quotation mark escape problem when splicing strings Single quote escape character

    To splice a single quotation mark around an existing string , I started to think ( error ) It can be used   \ escape , as follows : '\''+ str+'\'' Just look at the color and you'll see that it won't work . The correct way is to escape two single quotation marks into single quotation marks , as follows : ''''+str+'' ...

  7. PHP string manipulation Single quotation marks Double quotes heredoc nowdoc delimiter

    --- Resume content start --- 2019 year 2 month 22 Japan 09:49:54 Reference documents :   http://php.net/manual/zh/language.types.string.php#language. ...

  8. Python Single quotation marks are used for middle strings 、 Double quotation marks and triple quotation marks , What is triple quotation mark ? Under what circumstances and with what logo ?

    One . Three quotation marks are three single quotation marks or three double quotation marks : Two .Python If the string is in single quotation mark . Double quotation marks and triple quotation marks mark the beginning of , Then the end of the string must also be the corresponding identifier , Can't change : 3、 ... and . The similarities and differences of the three : 1. All three are strings , Most of the time ...

  9. js In the string replace Method to distinguish single and double quotation marks

    I have a problem today ,js Calling string in file replace Method , It doesn't work . After investigation, I may feel that replace("<option  value='1'>admin</option&g ...

Random recommendation

  1. javascript Set up input Box read only property obtain disabled And pass it to the background

    input Read-only property   There are two ways to do it input Read only effect of :disabled and readonly. Naturally, the two effects can only be read but not edited , But there is a big difference between the two . Disabled Explain the input ...

  2. Appium Middle part api How to use

    The language used is java,appium The version is 1.3.4,java-client The version is java-client-2.1.0, More references are recommended java-client-2.1.0-javadoc. 1. Use Andr ...

  3. ACM/ICPC And Introduction to network flow -Ford Fulkerson And SAP Algorithm (POJ1149-POJ1273)

    The first question is : According to the order of customers visiting the pigsty, the picture is composed in turn ( Customer as the node ), Confluence -> First customer -> Second customer ->...-> Confluence // The first network flow //Ford-Fulkerson //Time:47M ...

  4. Common statistics Sql summary ( turn )

    turn :http://www.cnblogs.com/zhangweizhong/p/5577842.html I've just been working on a BI Project , It needs a lot of sql Data statistics related applications , Deepen my understanding of SQL Understanding and ...

  5. 【36】 Never redefine inherited non-virtual Method

    1. Never redefine inherited non-virtual Method , Why? ? First of all to think about ,non-virtual What is the method ? in other words , Its use scenario . Of the parent class non-virtual Method , It's just telling subclasses , Inheritance implementation , Son ...

  6. jquery Of queue Method

    queue: queue It is mainly used to queue functions on elements ( The default name is fx) Add function ( Animation effect ), such dequeue You can take out and execute the first function in the function queue ( That is, the first function to enter the function queue ),delay You can delay the ...

  7. window.open Share your tips ( turn )

    Let's talk about it again today window.open It's because I found a fun trick , The details will be explained later .       Talk about window.open, I have to explain how to use it , There are two main forms :   window. ...

  8. zf- On the reform of Shaoxing County 2 A simple one. BUG But I need ORACLE Feeling of database

    Installed your database for a day , In fact, you can directly check out the background code , Then remote implementation, let him into the project , I look for it in his project action, All the pictures are the same , Sometimes, the requirement document also takes a screenshot of action Of , Fucking , I forgot such a simple way .

  9. Panel Load form in

    pnlMain.Controls.Clear(); ControlAnalyzer1 CA1 = new ControlAnalyzer1(); CA1.TopLevel = false; CA1.S ...

  10. Eclipse in Tomcat v8.0 Server at localhost The right choice Properties On the details page Server Locations Grayed out and cannot be edited

    Eclipse in Tomcat v8.0 Server at localhost The right choice Properties On the details page Server Locations Graying cannot edit solution :1. First of all, will Servers Deployed in ...