rockychen

1、字符串处理

宽字符集需要开启 php_mbstring 扩展

字符串截取

string substr ( string $string , int $start [, int $length ] )

string mb_substr ( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] ) 

 字符串长度

int strlen ( string $string )

mixed mb_strlen ( string $str [, string $encoding = mb_internal_encoding() ] )

 大小写转换

string strtolower ( string $string )

string strtoupper ( string $string )

 去除首尾空白字符

string trim ( string $str [, string $character_mask = " \t\n\r\0\x0B" ] )

string ltrim ( string $str [, string $character_mask ] )

string rtrim ( string $str [, string $character_mask ] )

 查找字符串中某些字符首次出现位置

mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )

 int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding = mb_internal_encoding() ]] )

 字符串替换

mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

 重复字符串

string str_repeat ( string $input , int $multiplier )

 字符串分割

array explode( string $input, string $char )

 

2、数组处理

获取关联数组中全部的键 

array_keys() / array_values()

判断关联数组中是否存在某个键 

array_key_exists() 

去除重复的元素

array_unique()

将一个或多个元素追加到数组中

array_push()

$arr[] = \'new value\'

删除数组中最后一个元素

array_pop()

数组长度

count()

检测存在

in_array()

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-12-26
  • 2021-07-30
  • 2021-12-26
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2021-06-13
  • 2021-12-13
  • 2021-11-18
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
相关资源
相似解决方案