Table of contents Home page
$s = "Hello world!\t\0"; // This string ends with various whitespace characters echo '**', rtrim($s), "**\n"; // Printed without trailing whitespace
$s = 'Hello world!--??'; echo rtrim($s, '-?'), "\n"; // Printed without trailing hyphens and question marks $s = 'Hello world!afyfzu893470'; echo rtrim($s ,'a..z0..9'), "\n"; // Printed without trailing lower case letters and digits // Note that the list of characters that should be trimmed (i.e. the second argument) can only contain single-byte // characters!