Php output variables increase brackets. what is the writing method? See the following code:
Source: Internet
Author: User
We can see that the php output variable adding brackets is the same as using the. operator to output the variable string, and summarize the following three points to help understand the role of php output variable adding brackets {} [php] We can see that the php output variable is used to increase the brackets. operator output variable string effect is the same, summed up the following three points to help understand the php output variable to increase the role of brackets {}: 1. represents a variable in {}, which is processed according to the variable during execution; 2. the special include method used to reference a variable in a string. to reduce the input of the code. 3. prevent variable names and strings from being connected together. Appendix: function of braces {} in string variables: add a braces {} after the PHP variable, and enter a number in it, that is, the character corresponding to the PHP variable serial number. Example: $ str = 'hello'; echo $ str {0}; // The output is hecho $ str {1 }; // the output is e. if you want to check whether a string contains a certain length, you can use this braces {} and isset to replace the strlen function. because isset is a language structure and strlen is a function, therefore, using isset is more efficient than using strlen. For example, judge whether the length of a string is smaller than 5: if (! Isset ($ str {5}) is better than if (strlen ($ str) <5.
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.