What are the ways of assigning values to php arrays
This article mainly explains "what are the ways to assign values to php arrays". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian to study and learn "what are the ways to assign values to php arrays" together.
1, two kinds of assignment
(1) Transfer value assignment
In PHP, passing assignment is the default. If the value of one variable is assigned to another variable, changing the value of one has no effect on the other variables.
(2) Reference assignment
Reference assignment means that the new variable simply references the original variable, and changing the value of the new variable affects the value of the original variable, and vice versa.
2. Examples
var map = new Array ("china","america","japan","canada");var a = [].concat(map);//or a = map.slice(0) Same effect a.unshift("aa");console.log(a);console.log(map);// a result [ "aa", "china", "america", "japan", "canada" ]//map result [ "china", "america", "japan", "canada" ]php is what language php, a nested abbreviation name, is an abbreviation for Hypertext Preprocessor. PHP is a HTML embedded language, PHP and Microsoft ASP quite similar, are a server-side execution of embedded HTML document scripting language, language style similar to C language, is now widely used by many website programmers.
Thank you for reading, the above is the "php array assignment method what" content, after the study of this article, I believe that we have a deeper understanding of the php array assignment method, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!