A Dynamic Key is an array key used to obtain an array value based on a Dynamic Value. This is very useful when your items have multiple variations.
Example Data
array(
'size'. => 'medium',
'prices' => array(
'large' => 24.99
'medium' => 17.99
'small' => 12.99
)
)
To obtain the price for the medium size item.
- Source key:
prices - Dynamic Key:
size - Output:
17.99
Notice size has a Dynamic Value. We take the value of size and search the prices array for the medium price.