doudiyu1639 2014-01-19 13:06
浏览 10

如何查找和中断序列号并将最终元素存储在PHP中的数组中? [关闭]

Lets suppose that I have a string such as:

'the exact number of files is 223,345,129'

I am looking for a piece of code that within a sequential number like (223,345,129) wherever it found a delimiter(a comma like ",") it breaks the number into 3 elements of 223 345 129 and store these 3 segments inside an array?

Thanks for answers in advance

  • 写回答

1条回答 默认 最新

  • dr200166 2014-01-19 13:07
    关注

    You may do it easily with the in-built PHP function explode:

    $arr = explode(",", "223,345,129");
    print_r($arr);
    

    The output will be:

    Array
    (
        [0] => 223
        [1] => 345
        [2] => 129
    )
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?