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