php - Concatenation Operator -


This can be a silly question, but it hit me, and here I ask.

  & lt ;? Php $ x = "hi"; $ Y = "There"; $ Z = $ x $ Y; $ A = "$ x $ y"; "$ Z" echo "& Lt; br / >"."$a"; ? & Gt;  

$ z uses the traditional concatenation operator provided by PHP and concatenates, the contrast is not $ one,

My questions :

  1. Does this affect performance, without using the operator?

  2. If this does not happen then the insertion operator is not at all.

  3. When someone works, why two methods of implementation?

  1. Just a little bit, because PHP The entire string has to be parsed in search of the variable, whereas with cocktiness, it slaps two variables simultaneously, then a small display is a hit, but for most things this is not noticeable.

  2. Adding variables such as $ _ server ['DOCUMENT_ROOT'] using the concatenation operator (with quotation marks, you have the variable in brackets Must be enclosed or the single quotation should be removed in the array index; plus it just looks the string all ugly). In addition, the conjunction operator allows more flexibility for formatting. For example, you can break a long string on several lines and then add different parts of the following:
      $ blah = "This is really a long string. ". "It's too long, but it's really long." "Or even boa constrictor wow.";  

    You can use the concatenation operator to include the return value directly from the function in the strangible (you can not include a function call in a double-quoted string) Like:

      $ blah = "This is a" Fn_call () "result, which can not be quote."; 
  3. I'm not sure that I fully understand what you are asking here, but I can say that PHP has bought a lot from Pearl, and one of these is Pearl's Mantra is "There are more than one way to do this."


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -