xref: /PHP-7.0/ext/standard/tests/array/max.phpt (revision f2fc267e)
1--TEST--
2max() tests
3--INI--
4precision=14
5--FILE--
6<?php
7
8var_dump(max());
9var_dump(max(1));
10var_dump(max(array()));
11var_dump(max(new stdclass));
12var_dump(max(2,1,2));
13var_dump(max(2.1,2.11,2.09));
14var_dump(max("", "t", "b"));
15var_dump(max(false, true, false));
16var_dump(max(true, false, true));
17var_dump(max(1, true, false, true));
18var_dump(max(0, true, false, true));
19
20echo "Done\n";
21?>
22--EXPECTF--
23Warning: max() expects at least 1 parameter, 0 given in %s on line 3
24NULL
25
26Warning: max(): When only one parameter is given, it must be an array in %s on line 4
27NULL
28
29Warning: max(): Array must contain at least one element in %s on line 5
30bool(false)
31
32Warning: max(): When only one parameter is given, it must be an array in %s on line 6
33NULL
34int(2)
35float(2.11)
36string(1) "t"
37bool(true)
38bool(true)
39int(1)
40bool(true)
41Done
42