Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的字符串:
hello this is my_string is-very-cool & another stuff
我如何通过所有特殊字符来爆炸(?)我的字符串,但允许空格 - 和 _ ?
有任何想法吗?
preg_split('/[^\w -]/', $string)
这将拆分任何不是 az、0-9、_、- 或空格的内容。