php-src/Zend/tests/decrement_001.phpt

68 lines
880 B
Plaintext
Raw Normal View History

2007-05-04 20:46:18 +08:00
--TEST--
decrementing different variables
2007-05-06 05:44:52 +08:00
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
2007-05-08 06:10:14 +08:00
--INI--
precision=14
2007-05-04 20:46:18 +08:00
--FILE--
<?php
$a = array(
2020-02-04 05:52:20 +08:00
array(1,2,3),
"",
1,
2.5,
0,
"string",
"123",
"2.5",
NULL,
true,
false,
new stdclass,
array(),
-PHP_INT_MAX-1,
(string)(-PHP_INT_MAX-1),
2007-05-04 20:46:18 +08:00
);
foreach ($a as $var) {
try {
$var--;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
2020-02-04 05:52:20 +08:00
var_dump($var);
2007-05-04 20:46:18 +08:00
}
echo "Done\n";
?>
2018-09-17 01:16:42 +08:00
--EXPECTF--
Cannot decrement array
2007-05-04 20:46:18 +08:00
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
int(-1)
int(0)
float(1.5)
int(-1)
string(6) "string"
int(122)
float(1.5)
NULL
bool(true)
bool(false)
Cannot decrement stdClass
2007-05-04 20:46:18 +08:00
object(stdClass)#%d (0) {
}
Cannot decrement array
2007-05-04 20:46:18 +08:00
array(0) {
}
float(-2147483649)
float(-2147483649)
Done