| @@ 152-168 (lines=17) @@ | ||
| 149 | * @param array|int|string,... |
|
| 150 | * @return null|int|string |
|
| 151 | */ |
|
| 152 | public static function max() |
|
| 153 | {
|
|
| 154 | $max = null; |
|
| 155 | $args = func_get_args(); |
|
| 156 | if (is_array($args[0])) {
|
|
| 157 | $args = $args[0]; |
|
| 158 | } |
|
| 159 | foreach ($args as $value) {
|
|
| 160 | if (null === $max) {
|
|
| 161 | $max = $value; |
|
| 162 | } else {
|
|
| 163 | if (bccomp($max, $value) < 0) {
|
|
| 164 | $max = $value; |
|
| 165 | } |
|
| 166 | } |
|
| 167 | } |
|
| 168 | ||
| 169 | return $max; |
|
| 170 | } |
|
| 171 | ||
| @@ 176-192 (lines=17) @@ | ||
| 173 | * @param array|int|string,... |
|
| 174 | * @return null|int|string |
|
| 175 | */ |
|
| 176 | public static function min() |
|
| 177 | {
|
|
| 178 | $min = null; |
|
| 179 | $args = func_get_args(); |
|
| 180 | if (is_array($args[0])) {
|
|
| 181 | $args = $args[0]; |
|
| 182 | } |
|
| 183 | foreach ($args as $value) {
|
|
| 184 | if (null === $min) {
|
|
| 185 | $min = $value; |
|
| 186 | } else {
|
|
| 187 | if (bccomp($min, $value) > 0) {
|
|
| 188 | $min = $value; |
|
| 189 | } |
|
| 190 | } |
|
| 191 | } |
|
| 192 | ||
| 193 | return $min; |
|
| 194 | } |
|
| 195 | ||