您是否有更好更快的方法从字符串的开头清除多个字符?
我有这个,但这真的是最快的方式吗?
$description_new = ltrim($description_new, '###');
$description_new = ltrim($description_new, '.');
$description_new = ltrim($description_new, ',');
$description_new = ltrim($description_new, '!');
$description_new = ltrim($description_new, '?');
$description_new = ltrim($description_new, ')');
$description_new = ltrim($description_new, '(');
由于 NIK
答案 0 :(得分:4)
第二个参数可以是charlist:
$description_new = ltrim($description_new, '#.,!?()');
如果符合您的需要,您还可以添加一系列字符:
$clean = ltrim($binary, "\x00..\x1F");