実際の操作配列から重複した要素を削除するPHPサンプルコードは次のとおりです。
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><strong><font color="#006699"><?</FONT></STRONG></SPAN><SPAN> </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN></SPAN><SPAN class=tag-name><STRONG><FONT color=#006699>function</FONT></STRONG></SPAN><SPAN> uniqueArray($array) </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>{ </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>// Get unique elts as keys in assoc. array </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>for ($</SPAN><SPAN class=attribute><FONT color=#ff0000>i</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>0</FONT></SPAN><SPAN>,$</SPAN><SPAN class=attribute><FONT color=#ff0000>n</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>count</FONT></SPAN><SPAN>($array, 1);$i</SPAN><SPAN class=tag><STRONG><FONT color=#006699><</FONT></STRONG></SPAN><SPAN>$n;$i++) </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>$u_array[$array[$i]] = 1; </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN> </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>// Copy keys only into another array </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>reset($u_array, 1); </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>for ($</SPAN><SPAN class=attribute><FONT color=#ff0000>i</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>0</FONT></SPAN><SPAN>,$</SPAN><SPAN class=attribute><FONT color=#ff0000>n</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>count</FONT></SPAN><SPAN>($u_array, 1);$i</SPAN><SPAN class=tag><STRONG><FONT color=#006699><</FONT></STRONG></SPAN><SPAN>$n;$i++) { </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>$unduplicated_array[] = key($u_array, 1); </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>next($u_array, 1); </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>} </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>return $unduplicated_array; </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>} </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN></SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></font></strong></span><span> </span></span></li> <li class=""><span> </span></li> </ol>上記の文字列コードは PHP の削除です。配列内の繰り返し要素の特定の実装です。
http://www.bkjia.com/PHPjc/446339.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/446339.html技術記事配列から重複要素を削除する実際の PHP 操作は次のとおりです。 ? function uniqueArray($array) { //Getuniqueeltsaskeysinassoc.array for($ i = 0 ,$ n = count ($array,1);$i $n .. .