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