function.array-count-values.html 5.7 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Z&auml;hlt die Werte eines Arrays</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.array-combine.html">array_combine</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.array-diff-assoc.html">array_diff_assoc</a></div>
 <div class="up"><a href="ref.array.html">Array Funktionen</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.array-count-values" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">array_count_values</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">array_count_values</span> &mdash; <span class="dc-title">Zählt die Werte eines Arrays</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.array-count-values-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>array_count_values</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$array</code></span>
   )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>array_count_values()</strong></span> gibt ein Array zurück, in
   dem die Werte des Arrays <code class="parameter">array</code> als
   Schlüssel, und die Häufigkeit ihres Auftretens als Werte angegeben sind.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.array-count-values-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>


    
     <dt>
<code class="parameter">array</code></dt>

     <dd>

      <p class="para">
       Das Array mit den zu zählenden Werten
      </p>
     </dd>

    

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.array-count-values-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt ein assoziatives Array mit den Werten aus <code class="parameter">array</code>
   als Schlüsseln und der Anzahl als Werten zurück.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.array-count-values-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Erzeugt ein <strong><code>E_WARNING</code></strong> für jedes Element, welches
   kein <span class="type"><a href="language.types.string.html" class="type string">string</a></span> oder <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> ist.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.array-count-values-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-4895">
    <p><strong>Beispiel #1 <span class="function"><strong>array_count_values()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$array&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"hello"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"world"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"hello"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">array_count_values</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende
Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [1] =&gt; 2
    [hello] =&gt; 2
    [world] =&gt; 1
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.array-count-values-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.count.html" class="function" rel="rdfs-seeAlso">count()</a> - Z&auml;hlt alle Elemente eines Arrays oder Attribute eines Objekts</span></li>
    <li class="member"><span class="function"><a href="function.array-unique.html" class="function" rel="rdfs-seeAlso">array_unique()</a> - Entfernt doppelte Werte aus einem Array</span></li>
    <li class="member"><span class="function"><a href="function.array-values.html" class="function" rel="rdfs-seeAlso">array_values()</a> - Liefert alle Werte eines Arrays</span></li>
    <li class="member"><span class="function"><a href="function.count-chars.html" class="function" rel="rdfs-seeAlso">count_chars()</a> - Gibt Informationen &uuml;ber die in einem String enthaltenen Zeichen
     zur&uuml;ck</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.array-combine.html">array_combine</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.array-diff-assoc.html">array_diff_assoc</a></div>
 <div class="up"><a href="ref.array.html">Array Funktionen</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>