PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/math/ceil_variation1.php

http://github.com/facebook/hiphop-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
  1. <?php
  2. /* Prototype : float ceil ( float $value )
  3. * Description: Round fractions up.
  4. * Source code: ext/standard/math.c
  5. */
  6. echo "*** Testing ceil() : usage variations ***\n";
  7. //get an unset variable
  8. $unset_var = 10;
  9. unset ($unset_var);
  10. // get a class
  11. class classA
  12. {
  13. }
  14. // heredoc string
  15. $heredoc = <<<EOT
  16. abc
  17. xyz
  18. EOT;
  19. // get a resource variable
  20. $fp = fopen(__FILE__, "r");
  21. // unexpected values to be passed to $value argument
  22. $inputs = array(
  23. // null data
  24. /* 1*/ NULL,
  25. null,
  26. // boolean data
  27. /* 3*/ true,
  28. false,
  29. TRUE,
  30. FALSE,
  31. // empty data
  32. /* 7*/ "",
  33. '',
  34. array(),
  35. // string data
  36. /*10*/ "abcxyz",
  37. 'abcxyz}',
  38. $heredoc,
  39. // object data
  40. /*13*/ new classA(),
  41. // undefined data
  42. /*14*/ @$undefined_var,
  43. // unset data
  44. /*15*/ @$unset_var,
  45. // resource variable
  46. /*16*/ $fp
  47. );
  48. // loop through each element of $inputs to check the behaviour of ceil()
  49. $iterator = 1;
  50. foreach($inputs as $input) {
  51. echo "\n-- Iteration $iterator --\n";
  52. var_dump(ceil($input));
  53. $iterator++;
  54. };
  55. fclose($fp);
  56. ?>
  57. ===Done===