Open
Conversation
Author
|
Just thought about it and there's no format catcher in this code. That is, no check to make sure the $string in the filter is numeric. If the value is text, it would return zero, though, so maybe that's the responsibility of the user? Or, could add a check for !is_string() since is_numeric() will return true with a mixed type, whereas the number_format() function will return zero with that kind of string (unless it starts with a number, in which it will return the numbers up to the beginning text). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey Tom!
This is ClosetDeveloper from webdevRefinery and have been experimenting with some additional filters. As my screen name on your forums suggests, I'm no expert, so hopefully my simple code meets your approval. =)
Just adding some simple formatting filters where you can format with commas and specify a single argument for the number of decimals. The other filter does exactly the same, but in a percent format, also specifying decimal places (automatically formats with commas and adds the percent sign).
Let me know what you think or if I'm way off-base. Don't mean to waste your valuable time!
Aaron