When C # was previously written, all the passing parameters were using objects. Now it is converted to PHP, and it is found that most people use Arrays for passing parameters. If arrays are used, the code will not know what values are stored in the array. Can you tell me whether to use arrays to pass parameters or objects to PASS Parameters in the project? When C # was previously written, all the passing parameters were using objects.
Now it is converted to PHP, and it is found that most people use Arrays for passing parameters. If arrays are used, the code will not know what values are stored in the array.
Can you tell me whether to use arrays to pass parameters or objects to PASS Parameters in the project?
Reply content:
When C # was previously written, all the passing parameters were using objects.
Now it is converted to PHP, and it is found that most people use Arrays for passing parameters. If arrays are used, the code will not know what values are stored in the array.
Can you tell me whether to use arrays to pass parameters or objects to PASS Parameters in the project?
As you actually use it, the array transmits a copy of the value, and the object transmits a reference.
Now PHP is more and more like JAVA. It is better to use the collection class to replace the array in a professional way. This will make data control more flexible and the collection class is friendly to code prompts. PHP allows you to use variable types that are not clear, but is not suitable for complex projects. It is difficult to understand element types in arrays.
The following Collection classes are implemented using PHP:
Http://www.jb51.net/article/38848.htm