Several useful php string filters convert function codes

  • 2020-05-17 04:55:15
  • OfStack

nl2br();// \n to

addslashes (); stripslashes (); // special characters are escaped when operating on a database

chop (); // remove the space to the right of the string
trim (); // removes all Spaces from the string
ltrim (); // remove the space to the left of the string

htmlspecialchars (); / / conversion '$',' "', ' < ',' > 'is the corresponding html entity
htmlentities (); // convert all html to the corresponding html entities

array explode(string separator, string str); // split the string
string implode(string separator, array arr); // connection string

strtoupper (); strtolower (); // converts case
ucfirst (); // converts only the first character to uppercase
ucwords (); // convert the first letter of each words to uppercase

Related articles: