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

Fetch data from php array (mainly delete specified elements)

PHPz
Release: 2018-10-12 10:09:06
forward
1735 people have browsed it

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);
Copy after login

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]);  
        }
}
Copy after login

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

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

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.


Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template