将数字分解为字符串


Explode numbers as string

我有一个字符串,其中包含由_ 连接的几个id

我需要将它们拆分成一个数组来进一步使用它们,但PHP总是将它们解析为整数并四舍五入,这使得id不可用。

如何将字符串拆分为字符串数组?

这是一些示例代码来说明问题:

$str = "version_52466436643546949646431_658465546513164146498646444346_4646464616416464649846465412113";
$explode = explode('_',$str);
print_r($explode); //the individual ids are rounded now

如何将其拆分为PHP将数字作为字符串而不是整数?

如果你知道你想要的拆分,这可能会奏效。。。。不过,我对PHP很陌生:)

function numStr($str, $count) {
     $words = explode("_", $str);
     $chunk = array_chunk($words, $count);
};
$str = "version_52466436643546949646431_658465546513164146498646444346_4646464616416464649846465412113";
$count = 23;

添加一些进一步的代码以消除'_'&'版本等。