Back to Browse

Learn PHP Tutorial in Hindi 16 Array and different way to create array

975 views
Oct 3, 2015
4:03

This video is made for learning about Array and different way to create array in PHP in Hindi. An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list vector, hash table an implementation of a map, dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible. Explanation of those data structures is beyond the scope of this manual, but at least one example is provided for each of them. For more information, look towards the considerable literature that exists about this broad topic. Syntax Specifying with array fx An array can be created using the array language construct. It takes any number of comma-separated key value pairs as arguments. The comma after the last array element is optional and can be omitted. This is usually done for single-line arrays, is preferred over array. For multi-line arrays on the other hand the trailing comma is commonly used, as it allows easier addition of new elements at the end. The key can either be an integer or a string. The value can be of any type. Additionally the following key casts will occur: Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer. Floats are also cast to integers, which means that the fractional part will be truncated. E.g. the key 8.7 will actually be stored under 8. Bools are cast to integers, too, i.e. the key true will actually be stored under 1 and the key false under 0. Null will be cast to the empty string, i.e. the key null will actually be stored under "". Arrays and objects can not be used as keys. Doing so will result in a warning: Illegal offset type. If multiple elements in the array declaration use the same key, only the last one will be used as all others are overwritten.

Download

0 formats

No download links available.

Learn PHP Tutorial in Hindi 16 Array and different way to create array | NatokHD