php - Zend/PHP : How to remove all leading 0s from string?

标签 php regex zend-framework

我有一个只包含数字的字符串。现在我想从该字符串中删除所有前导 0

例如:

input: 000000001230
output: 1230


input: 01000
output: 1000

在 PHP/Zend 中有这方面的功能吗?

谢谢

最佳答案

$myvar = ltrim('01000','0');

关于php - Zend/PHP : How to remove all leading 0s from string?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2636620/

相关文章:

PHP Date - 时差格式化

c# - 正则表达式搜索和替换,其中替换是搜索词的模组

regex - 使用 sed 转义单引号和双引号。 geed, 查找, xargs

php - Zend PHP 脚本运行速度非常慢

php - 如何在 zend 框架中将错误从模型传递到 Controller

php - SQLSTATE[HY000] [1045] 使用 000webhost 连接到数据库时出现异常

php - 如何将查询与 PHP 中的变化变量相关联

javascript - 当用户浏览网站时如何保留查询字符串参数

ruby - 字符串匹配(正则表达式)与正则表达式匹配(字符串)

php - ZF2 初始化器和 TranslatorAwareInterface