This article introduces the difference between single quotation marks and double quotation marks in php programs, as well as the efficiency problem between the two. if you need it, refer to it. Many friends always think that single quotes and double quotes in PHP are interconnected. The fields in double quotation marks are interpreted by the compiler and then output as html code. ''Is output directly without being interpreted in single quotes. It can be seen from the literal meaning that single quotes are faster than double quotes. For example: $ Abc = 'My name is tome '; echo $ abc // The result is: my name is tomecho' $ ABC' // The result is: $ abcecho "$ abc" // The result is: my name is tom.Especially when using MYSQL statements, the usage of double quotation marks and single quotation marks is confusing for beginners. Assume that constants are used in the query conditions, for example: Select * from abc_table where user_name = 'abc ';SQL statement: SQLstr = "select * from abc_table where user _ name = 'abc '";Assume that the query conditions use variables, for example: $ User_name = $ _ REQUEST ['User _ name']; // string variable or $ user = array ("name" => $ _ REQUEST ['User _ name ', "age" = >$ _ REQUEST ['age']; // array variableSQL statement: SQLstr = "select * from abc_table where user_name = '". $ user_name. "'"; SQLstr = "select * from abc_table where user_name = '". $ user ["name"]. ';Comparison: SQLstr = "select * from abc_table where user_name = 'abc'"; SQLstr = "select * from abc_table where user_name = '". $ user _ name. "'"; SQLstr = "select * from abc_table where user_name = '". $ user ["name"]. ';SQLstr can be divided into the following three parts: 1. "select * from table where user_name = '" // fixed SQL statement 2, $ user // variable 3, "'" 1, 2, use "between three strings ".. Let's test the efficiency ?! |