Home  >  Article  >  Backend Development  >  Fetch data from php array (mainly delete specified elements)

Fetch data from php array (mainly delete specified elements)

PHPz
PHPzforward
2016-07-29 08:34:231669browse

The content of this article is about fetching data from PHP arrays (mainly deleting specified elements). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1, delete the last element, and then return the array with one missing element

$views = $categories;、
$ite3 = array_pop($views);

2, delete the specified element, and return the array with one missing element

$personalityStyles = $categories;
foreach($personalityStyles as $k=>$v){    
if($v=='值'){  
      unset($personalityStyles[$k]);  
        }
}

3, delete the specified element, and then return the missing array An array with one element

unset ( $columnName [  array_search ( " 栏目 ",  $columnName )  ]  );

The above is the complete introduction to fetching data from PHP arrays (mainly deleting specified elements). If you want to know more aboutphp programming from beginner to proficient in a full set of video tutorials, please pay attention PHP Chinese website.


Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete