xref: /PHP-8.1/ext/standard/tests/array/min.phpt (revision 25f1c405)
1--TEST--
2min() tests
3--INI--
4precision=14
5--FILE--
6<?php
7
8try {
9    var_dump(min(1));
10} catch (\TypeError $e) {
11    echo $e->getMessage() . "\n";
12}
13
14try {
15    var_dump(min(array()));
16} catch (\ValueError $e) {
17    echo $e->getMessage() . "\n";
18}
19
20try {
21    var_dump(min(new stdclass));
22} catch (\TypeError $e) {
23    echo $e->getMessage() . "\n";
24}
25
26var_dump(min(2,1,2));
27var_dump(min(2.1,2.11,2.09));
28var_dump(min("", "t", "b"));
29var_dump(min(false, true, false));
30var_dump(min(true, false, true));
31var_dump(min(1, true, false, true));
32var_dump(min(0, true, false, true));
33
34?>
35--EXPECT--
36min(): Argument #1 ($value) must be of type array, int given
37min(): Argument #1 ($value) must contain at least one element
38min(): Argument #1 ($value) must be of type array, stdClass given
39int(1)
40float(2.09)
41string(0) ""
42bool(false)
43bool(false)
44bool(false)
45int(0)
46