Многоуровневый ассоциативный массив. На определенном уровне, пусть будет второй, связки ключ - значение. Ключи имеют вид Z123_XXX, т.е. буква Z, цифры, нижнее подчеркивание, а дальше что угодно. Надо из всех этих связок на этом уровне (ключ уровня тоже известен) отобрать связки, содержащие на конце ключа __KEY (два подчеркивания и слово). Отобранные собрать в отдельный ассоциативный массив, чтобы его можно было дальше использовать. Как такое можно сделать?
Необходимо использовать preg_grep() или другие способы есть?
UPD
переменная $result содержит примерно такой массив:
Array
(
[DISPLAY_PROPERTIES] => Array
(
// зона интереса
)
)
var_export($result["DISPLAY_PROPERTIES"])
array ( 'z009_RANGE_TEMP__KEY' => array ( 'ID' => '32', 'IBLOCK_ID' => '8', 'NAME' => 'Название 1', 'ACTIVE' => 'Y', 'SORT' => '1030', 'CODE' => 'z009_RANGE_TEMP', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 1', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '-70~100 (150)', 'PROPERTY_VALUE_ID' => '373', 'DESCRIPTION' => '', '~VALUE' => '-70~100 (150)', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '-70~100 (150)', ),
'z011_TEMP_ACCURACY' => array ( 'ID' => '36', 'IBLOCK_ID' => '8', 'NAME' => 'Название 2', 'ACTIVE' => 'Y', 'SORT' => '1070', 'CODE' => 'z011_TEMP_ACCURACY', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 2', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '±0,2', 'PROPERTY_VALUE_ID' => '375', 'DESCRIPTION' => '', '~VALUE' => '±0,2', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '±0,2', ),
'z015_GRADIENT_TEMP_5' => array ( 'ID' => '38', 'IBLOCK_ID' => '8', 'NAME' => 'Название 3', 'ACTIVE' => 'Y', 'SORT' => '1090', 'CODE' => 'z015_GRADIENT_TEMP_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 3', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '<2,0', 'PROPERTY_VALUE_ID' => '377', 'DESCRIPTION' => '', '~VALUE' => '<2,0', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '<2,0', ),
'z019_HEATING_TIME_5' => array ( 'ID' => '41', 'IBLOCK_ID' => '8', 'NAME' => 'Название 4', 'ACTIVE' => 'Y', 'SORT' => '1110', 'CODE' => 'z019_HEATING_TIME_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'N', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 4', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '-70...+100°С за 60 мин.', 'PROPERTY_VALUE_ID' => '379', 'DESCRIPTION' => '', '~VALUE' => '-70...+100°С за 60 мин.', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '-70...+100°С за 60 мин.', ),
'z020_COOLING_TIME_5' => array ( 'ID' => '57', 'IBLOCK_ID' => '8', 'NAME' => 'Название 5', 'ACTIVE' => 'Y', 'SORT' => '1130', 'CODE' => 'z020_COOLING_TIME_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'N', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 5', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '+20...-70°С за 80 мин.', 'PROPERTY_VALUE_ID' => '380', 'DESCRIPTION' => '', '~VALUE' => '+20...-70°С за 80 мин.', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '+20...-70°С за 80 мин.', ),
'z010_RANGE_HUMIDITY_5' => array ( 'ID' => '35', 'IBLOCK_ID' => '8', 'NAME' => 'Название 6', 'ACTIVE' => 'Y', 'SORT' => '1210', 'CODE' => 'z010_RANGE_HUMIDITY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 6', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '10-98', 'PROPERTY_VALUE_ID' => '374', 'DESCRIPTION' => '', '~VALUE' => '10-98', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '10-98', ),
'z016_HUMIDITY_ACCURACY_5' => array ( 'ID' => '39', 'IBLOCK_ID' => '8', 'NAME' => 'Название 7', 'ACTIVE' => 'Y', 'SORT' => '1230', 'CODE' => 'z016_HUMIDITY_ACCURACY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 7', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '±2,5', 'PROPERTY_VALUE_ID' => '378', 'DESCRIPTION' => '', '~VALUE' => '±2,5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '±2,5', ),
'z014_GRADIENT_HUMIDITY_5__KEY' => array ( 'ID' => '37', 'IBLOCK_ID' => '8', 'NAME' => 'Название 8', 'ACTIVE' => 'Y', 'SORT' => '1250', 'CODE' => 'z014_GRADIENT_HUMIDITY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 8', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '<5', 'PROPERTY_VALUE_ID' => '376', 'DESCRIPTION' => '', '~VALUE' => '<5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '<5', ),
'z008_INTERNAL_DIMENSIONS__KEE' => array ( 'ID' => '31', 'IBLOCK_ID' => '8', 'NAME' => 'Название 9', 'ACTIVE' => 'Y', 'SORT' => '2050', 'CODE' => 'z008_INTERNAL_DIMENSIONS', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 9', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '100x100x100', 'PROPERTY_VALUE_ID' => '372', 'DESCRIPTION' => '', '~VALUE' => '100x100x100', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '100x100x100', ),
'z006_DIMENSIONS' => array ( 'ID' => '29', 'IBLOCK_ID' => '8', 'NAME' => 'Название 10', 'ACTIVE' => 'Y', 'SORT' => '2900', 'CODE' => 'z006_DIMENSIONS', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 10', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '142x212x181,5', 'PROPERTY_VALUE_ID' => '371', 'DESCRIPTION' => '', '~VALUE' => '142x212x181,5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '142x212x181,5', ), );
Каждый вложенный массив перенес на новую строчку, чтобы хоть немногоч итабельности добавить.
Из этого всего надо получить:
array ( 'z009_RANGE_TEMP__KEY' => array ( 'ID' => '32', 'IBLOCK_ID' => '8', 'NAME' => 'Название 1', 'ACTIVE' => 'Y', 'SORT' => '1030', 'CODE' => 'z009_RANGE_TEMP', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 1', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '-70~100 (150)', 'PROPERTY_VALUE_ID' => '373', 'DESCRIPTION' => '', '~VALUE' => '-70~100 (150)', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '-70~100 (150)', ),
'z014_GRADIENT_HUMIDITY_5__KEY' => array ( 'ID' => '37', 'IBLOCK_ID' => '8', 'NAME' => 'Название 8', 'ACTIVE' => 'Y', 'SORT' => '1250', 'CODE' => 'z014_GRADIENT_HUMIDITY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 8', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '<5', 'PROPERTY_VALUE_ID' => '376', 'DESCRIPTION' => '', '~VALUE' => '<5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '<5', );
То есть оставить только те, что в названиях содержать __KEY на конце.
Я смог это сделать вот так:
$first = array ( 'z009_RANGE_TEMP__KEY' => array ( 'ID' => '32', 'IBLOCK_ID' => '8', 'NAME' => 'Название 1', 'ACTIVE' => 'Y', 'SORT' => '1030', 'CODE' => 'z009_RANGE_TEMP', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 1', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '-70~100 (150)', 'PROPERTY_VALUE_ID' => '373', 'DESCRIPTION' => '', '~VALUE' => '-70~100 (150)', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '-70~100 (150)', ),
'z011_TEMP_ACCURACY' => array ( 'ID' => '36', 'IBLOCK_ID' => '8', 'NAME' => 'Название 2', 'ACTIVE' => 'Y', 'SORT' => '1070', 'CODE' => 'z011_TEMP_ACCURACY', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 2', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '±0,2', 'PROPERTY_VALUE_ID' => '375', 'DESCRIPTION' => '', '~VALUE' => '±0,2', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '±0,2', ),
'z015_GRADIENT_TEMP_5' => array ( 'ID' => '38', 'IBLOCK_ID' => '8', 'NAME' => 'Название 3', 'ACTIVE' => 'Y', 'SORT' => '1090', 'CODE' => 'z015_GRADIENT_TEMP_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 3', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '<2,0', 'PROPERTY_VALUE_ID' => '377', 'DESCRIPTION' => '', '~VALUE' => '<2,0', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '<2,0', ),
'z019_HEATING_TIME_5' => array ( 'ID' => '41', 'IBLOCK_ID' => '8', 'NAME' => 'Название 4', 'ACTIVE' => 'Y', 'SORT' => '1110', 'CODE' => 'z019_HEATING_TIME_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'N', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 4', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '-70...+100°С за 60 мин.', 'PROPERTY_VALUE_ID' => '379', 'DESCRIPTION' => '', '~VALUE' => '-70...+100°С за 60 мин.', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '-70...+100°С за 60 мин.', ),
'z020_COOLING_TIME_5' => array ( 'ID' => '57', 'IBLOCK_ID' => '8', 'NAME' => 'Название 5', 'ACTIVE' => 'Y', 'SORT' => '1130', 'CODE' => 'z020_COOLING_TIME_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'N', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 5', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '+20...-70°С за 80 мин.', 'PROPERTY_VALUE_ID' => '380', 'DESCRIPTION' => '', '~VALUE' => '+20...-70°С за 80 мин.', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '+20...-70°С за 80 мин.', ),
'z010_RANGE_HUMIDITY_5' => array ( 'ID' => '35', 'IBLOCK_ID' => '8', 'NAME' => 'Название 6', 'ACTIVE' => 'Y', 'SORT' => '1210', 'CODE' => 'z010_RANGE_HUMIDITY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 6', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '10-98', 'PROPERTY_VALUE_ID' => '374', 'DESCRIPTION' => '', '~VALUE' => '10-98', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '10-98', ),
'z016_HUMIDITY_ACCURACY_5' => array ( 'ID' => '39', 'IBLOCK_ID' => '8', 'NAME' => 'Название 7', 'ACTIVE' => 'Y', 'SORT' => '1230', 'CODE' => 'z016_HUMIDITY_ACCURACY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 7', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '±2,5', 'PROPERTY_VALUE_ID' => '378', 'DESCRIPTION' => '', '~VALUE' => '±2,5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '±2,5', ),
'z014_GRADIENT_HUMIDITY_5__KEY' => array ( 'ID' => '37', 'IBLOCK_ID' => '8', 'NAME' => 'Название 8', 'ACTIVE' => 'Y', 'SORT' => '1250', 'CODE' => 'z014_GRADIENT_HUMIDITY_5', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 8', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '<5', 'PROPERTY_VALUE_ID' => '376', 'DESCRIPTION' => '', '~VALUE' => '<5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '<5', ),
'z008_INTERNAL_DIMENSIONS__KEE' => array ( 'ID' => '31', 'IBLOCK_ID' => '8', 'NAME' => 'Название 9', 'ACTIVE' => 'Y', 'SORT' => '2050', 'CODE' => 'z008_INTERNAL_DIMENSIONS', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 9', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '100x100x100', 'PROPERTY_VALUE_ID' => '372', 'DESCRIPTION' => '', '~VALUE' => '100x100x100', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '100x100x100', ),
'z006_DIMENSIONS' => array ( 'ID' => '29', 'IBLOCK_ID' => '8', 'NAME' => 'Название 10', 'ACTIVE' => 'Y', 'SORT' => '2900', 'CODE' => 'z006_DIMENSIONS', 'DEFAULT_VALUE' => '', 'PROPERTY_TYPE' => 'S', 'ROW_COUNT' => '1', 'COL_COUNT' => '30', 'LIST_TYPE' => 'L', 'MULTIPLE' => 'N', 'XML_ID' => NULL, 'FILE_TYPE' => '', 'MULTIPLE_CNT' => '5', 'LINK_IBLOCK_ID' => '0', 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'IS_D' => 'N', 'VERSION' => '1', 'USER_TYPE' => NULL, 'USER_TYPE_SETTINGS' => false, 'HINT' => '', '~NAME' => 'Название 10', '~DEFAULT_VALUE' => '', 'VALUE_ENUM' => NULL, 'VALUE_XML_ID' => NULL, 'VALUE_SORT' => NULL, 'VALUE' => '142x212x181,5', 'PROPERTY_VALUE_ID' => '371', 'DESCRIPTION' => '', '~VALUE' => '142x212x181,5', '~DESCRIPTION' => '', 'DISPLAY_VALUE' => '142x212x181,5', ), );
$second = array();
foreach ($first as $key => $value)
{
if(preg_match('/^.+__KEY$/',$key))
{
$second += array($key => $value);
}
}
Мой вариант работает, но насколько он правильный... Можно ли сделать это проще и лучше как по ресурсозатратам, так и по красоте кода? Нужно ли вообще перебирать массив?
var_export
array_filter()
вам поможет