"爸爸" , 1=>"妈妈" , 2 =>"舅舅" , 3 => "丈母娘",1 = >"弟"/>  "爸爸" , 1=>"妈妈" , 2 =>"舅舅" , 3 => "丈母娘",1 = >"弟">
Home > Backend Development > PHP Tutorial > 怎样将数组开展分析折分

怎样将数组开展分析折分

WBOY
Release: 2016-06-13 12:00:16
Original
946 people have browsed it

怎样将数组进行分析折分
如例:
$array= array ("1"  => "爸爸" , 1=>"妈妈" , 2 =>"舅舅" , 3 => "丈母娘",1 = >"弟弟" ,2=>"舅妈" , 1 => "大姐" , 3  =>"老婆")

怎样将我自己这边的亲人,老婆那边的亲人,妈妈那边的亲分进行折分。

------解决方案--------------------
你的数组有误,相同的下标后者覆盖前者!

$array = array ("爸爸", "妈妈", "舅舅", "丈母娘", "弟弟", "舅妈", "大姐", "老婆");<br />$r = preg_grep('/爸爸<br><font color='#FF8000'>------解决方案--------------------</font><br>妈妈<br><font color='#FF8000'>------解决方案--------------------</font><br>弟弟<br><font color='#FF8000'>------解决方案--------------------</font><br>大姐/', $array);<br />print_r($r);
Copy after login
Array
(
    [0] => 爸爸
    [1] => 妈妈
    [4] => 弟弟
    [6] => 大姐
)

Related labels:
source:php.cn
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