This time for everyone to bring the echo in PHP with a comma and use the number of points to summarize, in PHP echo with a comma and use the dot number of considerations, the following is the actual case, take a look.
Examples are as follows:
<?php//point and comma test, involving the forced conversion of strings echo 1+5;echo "<br/><br/>"; Echo ' 1+5= '. " 1+5 "." <br/> "; Echo ' 1+5= '." 5+1 "," <br/><br/> "; Echo ' 1+5= ', 1," <br/> ";//comma, no space needed for Echo ' 1+5= '. 1, "<br/>";//with connector, need space, otherwise error echo ' 1+5= ', 100+200, "<br/><br/>"; Using commas, often used to output multiple variables, does not affect the output//omitted the string stitching step, theoretically in the echo when the "comma" will be faster. Replace with a connector, note that the following test: Echo ' attention! <br/> '; Echo ' 1+5= '. "<br/>";//note. And 100 need space between, otherwise error echo ' 1+5= '. "<br/>"; Echo ' 1+5= '. 100+200, "<br/>";//Here The result begins to be abnormal echo ' 1+5= '. 200+100, "<br/>"; Echo (' 1+5= ') +100, "<br/>"; As you can see from the results above, the connector takes precedence over the operator echo "<br/>";//First Look at the forced conversion of the string echo (int) ' ABC1 '; echo "<br/>"; Echo (int) ' 1ABC '; echo "<br/>"; Echo (int) ' 22ABC '; echo "<br/><br/>";//Result: cast a string into a number, PHP will search for the beginning of the string,// If the beginning is a number then the conversion, if not directly return 0.//back to the question of the test echo ' result analysis: '; Echo ' 1+5= '. 100+200, "<br/>"; */* program is executed in this way, * First connect ' 1+5= '. 100 The result is the string ' 1+5=100 ', * then perform the operation, the string to be operated with the number will be cast by the system, the string ' 1+5= 100 ' converted value is 1, * last 1 +200=201. */* with commas why not? The manual says: The comma is multiple parameters. That is, multiple parameters, in other words, Commas are separated by the equivalent of n parameters. That is, ECHO is used as a function, so echo will calculate each parameter first, and then output separately, so we do not have the above problem with commas */?>
The results are as follows:
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
PHP implementation of the MySQL connection pool effect steps detailed
PHP operation recording temporary to permanent storage steps detailed