Created
July 3, 2017 13:41
-
-
Save 451F/2c75727058a1deba77c548cd0cb30c02 to your computer and use it in GitHub Desktop.
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
| <?php | |
| $input_array = [ | |
| "55.10", | |
| "55.01", | |
| "50.01", | |
| "55.00", | |
| "50.00" | |
| ]; | |
| function clear_zeroes(array $input) { | |
| $output = []; | |
| foreach ($input as $key => $value) { | |
| $output[] = preg_replace("/\.?0+$/", "", $value); | |
| } | |
| return $output; | |
| } | |
| var_dump(clear_zeroes($input_array)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment