What does the continuous use of "equal sign" mean? The following is a piece of code in dedecms: $ dsql $ dbnew & nbsp; DedeSql (FALSE) is assigned a value. what does this method mean? ------ Solution -------------------- assign $ a & nbsp; $ B & continuously use the "equal sign?
The following is a piece of code in dedecms:
$ Dsql = $ db = new DedeSql (FALSE)
A "=" is a value assignment,
What does this method mean?
------ Solution --------------------
Assign values at the same time
$ A = $ B = 1;
Equivalent
$ A = 1;
$ B = 1;
However, note that
$ Dsql = $ db = new DedeSql (FALSE)
Not equivalent
$ Dsql = new DedeSql (FALSE );
$ Db = new DedeSql (FALSE );
The former is that two variables are the same instance.
The latter is an instance for each of the two variables.
------ Solution --------------------
I learned a little more, and the moderator is amazing.
------ Solution --------------------
I have never used it like this.
------ Solution --------------------
This kind of thing requires not memory, but practice.
Class T {
Public $ v = 1;
}
$ A = $ B = new T;
Echo $ a-> v, '', $ B-> v; // 1 1
$ B-> v = 'a ';
Echo $ a-> v, '', $ B-> v; //