How to get specific key value from array in PHP ?
In this article, we will see how to get specific key values from the given array. PHP array is a collection of items that are stored under keys. There are two possible types of keys: strings and integers. For any type of key, there is a common syntax to get a specific value by key — square brackets.
An item by index 0: 10 An item by key 'hello': world
Example 2: Sometimes we can accidentally try to get a non-existent item from the array. In this case, PHP throws a NOTICE. To avoid the issue, we have to check the key existence before accessing it.
There are no value under the index 10 A value under the index 10: unknown