RE: Hide 2 decimal places in a string

Don’t think rounding is the answer. Would just prefer to hide all numbers after the decimal

Well you could treat your number as an actual number, and then apply the appropriate mathematical operator to what you’re trying to do (round, floor, etc)

In terms of pure string manipulation, what you’re describing is covered by a preg_replace.
Alternatively, you can use string operators to find the position of the last period in the number and then take the rest of the string.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.