When you write C # before, the pass-through parameter is used by the object.
Now to PHP, found that most of the people are using an array of parameters, the array will cause later to see the code does not know what values are stored in the array.
Daniel, do you use arrays to pass parameters or to pass parameters with objects?
Reply content:
When you write C # before, the pass-through parameter is used by the object.
Now to PHP, found that most of the people are using an array of parameters, the array will cause later to see the code does not know what values are stored in the array.
Daniel, do you use arrays to pass parameters or to pass parameters with objects?
To see what you actually use, the array passes the value copy, and the object passes the reference.
Now PHP is more and more like Java, the more professional approach is best to replace the array with the collection class, so that the control of the data is more flexible, and the use of the collection class for code hints is very friendly. PHP allows you to use ambiguous variable types, but it is not suitable for complex projects, and it is difficult to understand the element types in the array.
The following is the collection class implemented in PHP
Http://www.jb51.net/article/38848.htm