Created
December 17, 2019 15:46
-
-
Save MartinTale/3696e4a2aa9374f7b569ecbedaad4446 to your computer and use it in GitHub Desktop.
PHP function that converts number to a number with sign in front of it..
This file contains 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 | |
if (! function_exists('numberWithSign')) | |
{ | |
function numberWithSign($number) | |
{ | |
if ($number < 0) { | |
return round($number, 2); | |
} else { | |
return '+' . round($number, 2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment