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