source: branches/version-2_5-dev/data/module/Compat/tests/function/array_product.phpt @ 19792

Revision 19792, 826 bytes checked in by Seasoft, 13 years ago (diff)

#744(PHP4 互換用途ソースを将来的に切り捨てやすい仕組みづくり)

Line 
1--TEST--
2Function -- array_product
3--SKIPIF--
4<?php if (function_exists('array_product')) { echo 'skip'; } ?>
5--FILE--
6<?php
7require_once 'PHP/Compat.php';
8PHP_Compat::loadFunction('array_product');
9
10function ehandler($no, $str)
11{
12    echo '(Warning) ';
13}
14set_error_handler('ehandler');
15
16$tests = array(
17    'foo',
18    array(),
19    array(0),
20    array(3),
21    array(3, 3),
22    array(0.5, 2, 3)
23);
24
25foreach ($tests as $v) {
26    echo "testing: (", (is_array($v) ? implode(' * ', $v) : $v), ")\n    result: ";
27    var_dump(array_product($v));
28    echo "\n\n";
29}
30
31restore_error_handler();
32?>
33--EXPECT--
34testing: (foo)
35    result: (Warning) NULL
36
37
38testing: ()
39    result: int(0)
40
41
42testing: (0)
43    result: int(0)
44
45
46testing: (3)
47    result: int(3)
48
49
50testing: (3 * 3)
51    result: int(9)
52
53
54testing: (0.5 * 2 * 3)
55    result: float(3)
Note: See TracBrowser for help on using the repository browser.