backslashit()
Adds backslashes before letters and before a number at the start of a string.
No Hooks.
Return
String
. String with backslashes inserted.
Usage
backslashit( $value );
- $value(string) (required)
- Value to which backslashes will be added.
Examples
#1 Add escaping slashes to the line characters.
$string = "321!hello&<-->ещеLetters&123"; echo backslashit( $string ); // we get: 1!\h\e\l\l\o&<-->еще\L\e\t\t\e\r\s&123
Changelog
Since 0.71 | Introduced. |
backslashit() backslashit code WP 6.6.1
function backslashit( $value ) { if ( isset( $value[0] ) && $value[0] >= '0' && $value[0] <= '9' ) { $value = '\\\\' . $value; } return addcslashes( $value, 'A..Za..z' ); }