- Split functions and styles from index

- Start building generic log retrieval function
This commit is contained in:
Keith Solomon
2022-12-17 13:26:00 -06:00
parent be45c71db4
commit e8fe2957a5
4 changed files with 84 additions and 108 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
function searchForId($id, $array)
{
foreach ($array as $key => $val) {
if ($val[1] == $id) {
return $key;
}
}
return null;
}
function formatMoney($number, $cents = 1)
{ // cents: 0=never, 1=if needed, 2=always
if (is_numeric($number)) { // a number
if (!$number) { // zero
$money = ($cents == 2 ? '0.00' : '0'); // output zero
} else { // value
if (floor($number) == $number) { // whole number
$money = number_format($number, ($cents == 2 ? 2 : 0)); // format
} else { // cents
$money = number_format(round($number, 2), ($cents == 0 ? 0 : 2)); // format
} // integer or decimal
} // value
return '$' . $money;
} // numeric
} // formatMoney
?>