原数组:


$array = array(
  'name' => 'hotel',
  'remark' => '',
  'bed-1' => 1,
  'bed-2' => 2,
  'bed-3' => 3,
)

函数:


$filtered = array_filter($array, function ($key) {
    return strpos($key, 'bed-') === 0;
}, ARRAY_FILTER_USE_KEY);

新数组:


$filtered = array(
  'bed-1' => 1,
  'bed-2' => 2,
  'bed-3' => 3,
)