What is the most important difference between PHP arrays and C arrays? Based on your guess, what is the advantage of PHP arrays in Web programming?
PHP arrays are more like hashmaps , which make pairs of keys and values while C array is index and values. Furthemore, PHP arrays can also maintain the order of the array items.
As a popular web programming language, I guess that PHP arrays is invented to make the interactions with the “web data” more convenient. Firstly, PHP array is a combination of common data structures, such as array, map, set, list or dictionary. So we can more focus on the functions and algorithms instead of the lower level data structures. Secondly, many php codes “talk” to databases and fetch “web data” from them. Such data often in the forms of keys and values are most common in web applications. PHP arrays combined with multiple functions can better apply to those data. In conclusion, the wide combinations of many traditional common data structures make PHP arrays flexibly apply to many web situations.
“which make pairs of keys and values” –> “which is made of pairs of keys and values”?
“C array is index and values” –> “C arrays are indexed values”
“can more focus on” –> “can focus on”
“lower level data structures” –> “low-level data structures”
“are most common” –> “are common”
“combined with multiple functions” what does it mean?
“make PHP arrays flexibly apply” –> “make PHP arrays flexibly applicable”