Posts

Showing posts from March, 2018

PHP unit2

Q) What Are Arrays? Explain how to create an Array. Arrays are indexed, which means that each entry is made up of a key and a value. The key is the index position, beginning with 0 and increasing incrementally by 1 with each new element in the array.   The value can be a string, an integer, or whatever we gave to it. Creating Arrays: An array can be created using either the array ( ) function or the array operator []. The array ( ) function is usually used when we create a new array and populate it with more than one element. The array operator [ ] is often used when we want to create a new array with just one element at the outset, or when you want to add to an existing array element. Creating Array using the array ( ) function: $rainbow =   array(“red”,   “orange”, “yellow”, “green”, “blue”, “indigo”, “violet”); Creating Array using the array operator[ ]: $rainbow[ ] =   “red”; $rainbow[ ] =   “orange”; $rainbow[ ] =   ...