Home >Backend Development >PHP Tutorial >请问怎么去掉字符串第一个逗号

请问怎么去掉字符串第一个逗号

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:11:541367browse

,abcdefg,sfsdfsdfsd,sfddfs
,,abcdefg,sfsdfsdfsd,sfddfs

我想把左边的逗号去掉,至于是一个或者两个是不确定的,不过最多两个,请问怎么去掉左边的逗号。


回复讨论(解决方案)

$s = preg_replace('/,/', '', $s, 1); 

ltrim(string,charlist)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn