Get the App
SLTechnology News&Howtos  ›  Development  › 

How to remove the excess zero by PHP

Shulou Source: shulou.com Published: 2022-06-03 19:49:50 10月26日 Update

This article introduces the relevant knowledge of "how to remove excess zero by PHP". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

/ * *

* remove excess 0

, /

Function del0 ($s)

{

$s = trim (strval ($s))

If (preg_match ('# ^ -?\ dcats?\ .0 + $#', $s)) {

Return preg_replace ('# ^ (-?\ dbath?)\ .0 + $#','$1 million, etc.)

}

If (preg_match ('# ^ -?\ dbath?\. [0-9] +?)) {

Return preg_replace ('# ^ (-?\ d +\. [0-9] +?)

}

Return $s

}

This is the end of the content of "how to get rid of excess zero in PHP". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Code content more knowledge practical successful learning next dilemma reality situation article case editing website industry process high quality learning related output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Apple vpn Docker MySQL