|
|
@@ -6,40 +6,42 @@
|
|
|
<title>InArray</title>
|
|
|
|
|
|
<para>
|
|
|
- <classname>Zend_Validate_InArray</classname> allows you to validate if a given value is
|
|
|
- contained within an array. It is also able to validate multidimensional arrays.
|
|
|
+ <classname>Zend_Validate_InArray</classname> erlaubt es zu prüfen ob ein gegebener Wert
|
|
|
+ in einem Array enthalten ist. Er ist auch in der Lage mehrdimensionale Arrays zu prüfen.
|
|
|
</para>
|
|
|
|
|
|
<sect3 id="zend.validate.set.in_array.basic">
|
|
|
- <title>Simple array validation</title>
|
|
|
+ <title>Einfache Array Prüfung</title>
|
|
|
|
|
|
<para>
|
|
|
- The simplest way, is just to give the array which should be searched against at
|
|
|
- initiation:
|
|
|
+ Der einfachste Weg ist es, das Array welches durchsucht werden soll, bei der
|
|
|
+ Initiierung anzugeben:
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$validator = new Zend_Validate_InArray(array('key' => 'value', 'otherkey' => 'othervalue'));
|
|
|
if ($validator->isValid('value')) {
|
|
|
- // value found
|
|
|
+ // Wert gefunden
|
|
|
} else {
|
|
|
- // no value found
|
|
|
+ // Wert nicht gefunden
|
|
|
}
|
|
|
]]></programlisting>
|
|
|
|
|
|
<para>
|
|
|
- This will behave exactly like <acronym>PHP</acronym>'s <methodname>in_array()</methodname> method.
|
|
|
+ Das verhält sich genauso wie <acronym>PHP</acronym>'s
|
|
|
+ <methodname>in_array()</methodname> Methode.
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
<para>
|
|
|
- Per default this validation is not strict nor can it validate multidimensional arrays.
|
|
|
+ Standardmäßig ist diese Prüfung nicht strikt noch kann Sie mehrdimensionale Arrays
|
|
|
+ prüfen.
|
|
|
</para>
|
|
|
</note>
|
|
|
|
|
|
<para>
|
|
|
- Of course you can give the array to validate against also afterwards by using the
|
|
|
- <methodname>setHaystack()</methodname> method.
|
|
|
+ Natürlich kann man das Array gegen das geprüft werden soll auch im Nachhinein durch
|
|
|
+ Verwendung der <methodname>setHaystack()</methodname> Methode angegeben werden.
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
@@ -47,26 +49,27 @@ $validator = new Zend_Validate_InArray();
|
|
|
$validator->setHaystack(array('key' => 'value', 'otherkey' => 'othervalue'));
|
|
|
|
|
|
if ($validator->isValid('value')) {
|
|
|
- // value found
|
|
|
+ // Wert gefunden
|
|
|
} else {
|
|
|
- // no value found
|
|
|
+ // Wert nicht gefunden
|
|
|
}
|
|
|
]]></programlisting>
|
|
|
</sect3>
|
|
|
|
|
|
<sect3 id="zend.validate.set.in_array.strict">
|
|
|
- <title>Strict array validation</title>
|
|
|
+ <title>Strikte Array Prüfung</title>
|
|
|
|
|
|
<para>
|
|
|
- As mentioned before you can also do a strict validation within the array. Per default there
|
|
|
- would be no difference between the integer value <emphasis>0</emphasis> and the string
|
|
|
- <emphasis>"0"</emphasis>. When doing a strict validation this difference will also be
|
|
|
- validated and only same types are accepted.
|
|
|
+ Wie vorher erwähnt kann man auch eine Strikte Prüfung im Array durchführen.
|
|
|
+ Standardmäßig würde kein Unterschied zwischen dem Integerwert <emphasis>0</emphasis>
|
|
|
+ und dem String <emphasis>"0"</emphasis> sein. Wenn eine strikte Prüfung durchgeführt
|
|
|
+ wird dann wird dieser Unterschied auch geprüft und nur gleiche Typen werden akzeptiert.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
- A strict validation can also be done by using two different ways. At initiation and by using
|
|
|
- a method. At initiation you have to give an array with the following structure:
|
|
|
+ Eine strikte Prüfung kann auch auf zwei verschiedenen Wegen durchgeführt werden. Bei
|
|
|
+ der Initiierung und durch Verwendung einer Methode. Bei der Initiierung muß hierfür ein
|
|
|
+ Array mit der folgenden Struktur angegeben werden:
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
@@ -78,9 +81,9 @@ $validator = new Zend_Validate_InArray(
|
|
|
);
|
|
|
|
|
|
if ($validator->isValid('value')) {
|
|
|
- // value found
|
|
|
+ // Wert gefunden
|
|
|
} else {
|
|
|
- // no value found
|
|
|
+ // Wert nicht gefunden
|
|
|
}
|
|
|
]]></programlisting>
|
|
|
|