gpt4 book ai didi

mysql - 需要在 MYSQL 中用 - 分隔符分隔字符串

转载 作者:行者123 更新时间:2023-11-29 04:39:21 25 4
gpt4 key购买 nike

我在 MYSQL 表字段中有这个字符串 1111-2222-3-4-55-12345678901234567 1

我需要做的是用 - 分隔前 5 个参数。就像我需要分开一样:

1111
2222
3
4
55

最佳答案

$stringElements = explode('-', $string);
echo $stringElements[0];// 1111
echo $stringElements[1];// 2222
echo $stringElements[2];// 3
echo $stringElements[3];// 4
echo $stringElements[4];// 55
$stringElements[5];// 12345678901234567 1

关于mysql - 需要在 MYSQL 中用 - 分隔符分隔字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33104034/

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