summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/count_invalid.phpt
blob: 95da00dac5100a914f768ea231765991196eceb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
Only arrays and countable objects can be counted
--FILE--
<?php

$result = count(null);
var_dump($result);

$result = count("string");
var_dump($result);

$result = count(123);
var_dump($result);

$result = count(true);
var_dump($result);

$result = count(false);
var_dump($result);

$result = count((object) []);
var_dump($result);

?>
--EXPECTF--
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(1)