Is it possible in php to make an array an array key as well?
Example:
array(
array('sample', 'abc') => 'sample value'
);
As array values can be other arrays, trees and multidimensional arrays are also possible. And : The key can either be an integer or a string. The value can be of any type.
The array_keys() function returns an array containing the keys.
PHP array_key_exists() Function The array_key_exists() function checks an array for a specified key, and returns true if the key exists and false if the key does not exist.
Technical Details. Return Value: Returns the key of the array element that is currently being pointed to by the internal pointer. PHP Version: 4+
No, if you read the manual
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.
And :
The key can either be an integer or a string. The value can be of any type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With