Php,返回字符串在“Php”之前的部分;0〃;


Php, return portion of string before "0"

我在PHP方法中搜索字符串的返回部分,在"0"之前没有数字(1-9)。

示例:

604000

我要PHP脚本返回:

604

你能帮我吗?

只需使用rtrim()作为

$str="604000";
echo $str = rtrim($str, '0');