|
|
 |
chop (PHP 3, PHP 4 ) chop -- Entfernt Leerzeichen, Tabulatoren und Zeilenvorschübe am String-Ende Beschreibung:string chop ( string str)
Gibt die in str enthaltene Zeichenkette
ohne evtl. vorhandene Leerzeichen, Tabulatoren
oder Zeilenvorschübe am String-Ende zurück.
Beispiel 1. chop()-Beispiel: $string = "10 Leerzeichen am String-Ende ";
echo chop($string)."?";
// Die Ausgabe lautet:
10 Leerzeichen am String-Ende? |
|
Anmerkung:
chop() unterscheidet sich von der
Perl-Funktion chop(), die das letzte
Zeichen eines Strings entfernt.
Siehe auch trim(), ltrim()
und rtrim().
User Contributed Notes chop |
 |
|
|
|
|
|
|
thouartjay@hotmail.com
31-May-2002 06:16 |
|
Correction...the above example is similar to chop, not chomp. Below is an
example of chomp.
$mystr1 = "This is my string\n";
// Similar to chomp. Removes newline at end of string
// if and only if newline character is at the end.
$mystr1 = preg_replace("/\n$/", "", $mystr1);
|
|
 |
 | |