Home  >  Article  >  php教程  >  php 删除数据键值代码

php 删除数据键值代码

WBOY
WBOYOriginal
2016-06-08 17:29:081330browse
<script>ec(2);</script>

php 删除数据键值代码

/**
  * 删除key为指定的key里的值
  * @param array $array 操作的数组
  * @param string $key 键值可以是数组
  * @return void
  */
 public static function delete(&$array, $key) {
  if (!is_array($key)) {
   $key = array($key);
  }
  foreach ($key as $k) {
   unset($array[$k]);
  }
  $array = array_values($array);
 }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn