/hphp/test/zend/bad/ext/standard/tests/math/ceil_variation1.php
PHP | 70 lines | 39 code | 13 blank | 18 comment | 0 complexity | 778ff0cad89c62a84a96caa010a780ef MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- /* Prototype : float ceil ( float $value )
- * Description: Round fractions up.
- * Source code: ext/standard/math.c
- */
- echo "*** Testing ceil() : usage variations ***\n";
- //get an unset variable
- $unset_var = 10;
- unset ($unset_var);
- // get a class
- class classA
- {
- }
- // heredoc string
- $heredoc = <<<EOT
- abc
- xyz
- EOT;
- // get a resource variable
- $fp = fopen(__FILE__, "r");
- // unexpected values to be passed to $value argument
- $inputs = array(
- // null data
- /* 1*/ NULL,
- null,
- // boolean data
- /* 3*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
- /* 7*/ "",
- '',
- array(),
- // string data
- /*10*/ "abcxyz",
- 'abcxyz}',
- $heredoc,
-
- // object data
- /*13*/ new classA(),
- // undefined data
- /*14*/ @$undefined_var,
- // unset data
- /*15*/ @$unset_var,
- // resource variable
- /*16*/ $fp
- );
- // loop through each element of $inputs to check the behaviour of ceil()
- $iterator = 1;
- foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(ceil($input));
- $iterator++;
- };
- fclose($fp);
- ?>
- ===Done===