LoginSignup
3
2

More than 5 years have passed since last update.

php で連想配列のキーを指定したarray_popみたいなもの

Posted at

配列関数にこういうのあったら嬉しかったけど、なかった…。

array_pop_key.php
 public static function array_pop_key(&$array, $key)
  {
    $value = null;
    if(isset($array[$key]))
    {
      $value = $array[$key];
      unset($array[$key]);
    }
    return $value;
  }
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2