字符串函数与逻辑运算
1.字符串函数
- strlen(s) : 返回字符串的长度;
- strtoupper(s) : 将字符串转为大写;
- strtolower(s):将字符串转为小写;
- trim(s): ltrim(s); rtrim(s) : 从两端(左右)删除字符串中的空白字符;
- strstr(h, n): 查找字符串在另一个字符串中的位置,输出之后的字符;
- strchr(h, n): 同上;
- substr(s, start, (length)): 返回字符串的一部分;
- str_replace (s, to,from,): 从from中找到s 替换位to;
- explode(d, s) 把字符串打散为数组;
- implode(d, s) 把数组元素组合为一个字符串;
- strcmp(s1, s2) : 比较两个字符串(大小写敏感);
- strcasecmp(s1, s2) : 比较两个字符串(大小写不敏感);
- str_shuffle(s): 随机打乱字符串中的所有字符;
- strrev(s): 反转字符串;
- htmlspecialchar(s): 把一些预定义字符转换为html实体;
- orf© 返回字符串第一个字符的ASCII 值;
- chr(n) 从指定的ASCII值返回字符
- str_pad(s, length): 把字符串填充为新的长度;
- str_repeat(s, times): 把字符串重复指定的次数;
- print(format, …): 输出格式化的字符;
- sprintf