gpt4 book ai didi

php - 如何在 PHP 中通过多个分隔符拆分字符串?

转载 作者:IT王子 更新时间:2023-10-29 01:24:20 27 4
gpt4 key购买 nike

“这里有东西;那里,哦,就这些!”

我想用;,拆分

所以经过处理应该得到:

something here

and there

oh

that's all!

最佳答案

<?php

$pattern = '/[;,]/';

$string = "something here ; and there, oh,that's all!";

echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';

关于php - 如何在 PHP 中通过多个分隔符拆分字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1452777/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com