PHP can only be used array= (), in the new version of the phrase used in the square brackets []. Is the curly brace {} not more in line with the general public?
C # int[] array = {1, 2, 3, 4, 5, 6};
Java int[] arr = {0,0,0,0,0,0,0,0,0,0,0,};
Python (
One, no matter what the program, function name () {}, for () {}, .... Too much, do not say also know what to do with.
Second, the $str {4} After the variable of the string followed by {} curly braces and brackets are the same as the string variable
One, no matter what the program, function name () {}, for () {}, .... Too much, do not say also know what to do with.
Two, $str {4} After the string's variable followed by {} braces and brackets are all treating a string variable as an array.
Three,
Transfer from http://www.cnblogs.com/jayleke/archive/2011/11/08/2241609.html1. Simple syntax rules (use curly braces to define variable names for all versions of PHP): $a = ' flower '; echo "She received some $as"; The letter S will be considered as
1. When array is a continuous array starting from 0, the result of Json_encode is a string enclosed by []And when array is not starting from 0 or discontinuous arrays, the result of Json_encode is a string of key-value pattern enclosed by {}$test =
PHP Summary
Summary of basic knowledge: a summary of single-quote double-quote curly braces in PHPIn PHP, strings can be represented by single quotes or double quotes, output, and so on.For example:
PHP code
Their output is the same. Will print
Use of braces (curly braces {}) in PHP
There are basically three cases of using braces in php. The following article summarizes these three cases.
I. function name () {}, for () {} and so on. I will not talk about this situation, but I also know
BracesMany languages use curly braces as scope boundaries, and only the curly braces of functions in PHP form a new scope.The operating result is:String (5) "Var a" string (5) "Var C" string (5) "Var B" string (5) "Var C"Visible if and for curly
The role of PHP curly braces
When the PHP parser encounters a dollar ($) symbol, he will, like many other parsers, assemble as many tokens as possible to form a valid variable name.
You can use curly braces to define the bounds of a
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.