У меня следующее работает нормально:
Код: Выделить всё
$array_1 = array(
'ads' => ['code' => 10000, 'item' => 19999, 'cost' => 'array_2'],
'offers' => ['code' => 20000, 'item' => 29999, 'cost' => 'array_3'] );
$array_2 = array(
'price' => '232',
'surcharge'=> '110' );
$ads_prices = $array_1['ads']['cost'];
$ads_prices = $$ads_prices;
print_r($ads_prices);
Output: Array( [price] => 232
[surcharge] => 110 )
Код: Выделить всё
$ads_prices = $array_1['ads'][$$'cost'];
Подробнее здесь: https://stackoverflow.com/questions/798 ... dex-in-php
Мобильная версия