1--TEST-- 2Test is_countable() function 3--CREDITS-- 4Gabriel Caruso (carusogabriel34@gmail.com) 5--FILE-- 6<?php 7var_dump(is_countable([1, 2, 3])); 8var_dump(is_countable((array) 1)); 9var_dump(is_countable((object) ['foo', 'bar', 'baz'])); 10var_dump(is_countable()); 11 12$foo = ['', []]; 13 14if (is_countable($foo)) { 15 var_dump(count($foo)); 16} 17 18$bar = null; 19if (!is_countable($bar)) { 20 count($bar); 21} 22?> 23--EXPECTF-- 24bool(true) 25bool(true) 26bool(false) 27 28Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d 29NULL 30int(2) 31 32Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d 33