A WordPress-centric search engine for devs and theme authors



backslashit ›

Since0.71
Deprecatedn/a
backslashit ( $string )
Parameters:
  • (string) $string Value to which backslashes will be added.
    Required: Yes
Returns:
  • (string) String with backslashes inserted.
Defined at:
Codex:

Adds backslashes before letters and before a number at the start of a string.



Source

function backslashit( $string ) {
	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
		$string = '\\\\' . $string;
	}
	return addcslashes( $string, 'A..Za..z' );
}