????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.28 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/b8009/php-5.6.22/ext/standard/tests/math/ |
Upload File : |
--TEST--
Test floor() function : usage variations - different data types as $value arg
--INI--
precision=14
--FILE--
<?php
/* Prototype : float floor ( float $value )
* Description: Round fractions down.
* Source code: ext/standard/math.c
*/
echo "*** Testing floor() : 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 floor()
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
var_dump(floor($input));
$iterator++;
};
fclose($fp);
?>
===Done===
--EXPECTF--
*** Testing floor() : usage variations ***
-- Iteration 1 --
float(0)
-- Iteration 2 --
float(0)
-- Iteration 3 --
float(1)
-- Iteration 4 --
float(0)
-- Iteration 5 --
float(1)
-- Iteration 6 --
float(0)
-- Iteration 7 --
float(0)
-- Iteration 8 --
float(0)
-- Iteration 9 --
bool(false)
-- Iteration 10 --
float(0)
-- Iteration 11 --
float(0)
-- Iteration 12 --
float(0)
-- Iteration 13 --
Notice: Object of class classA could not be converted to int in %s on line %d
float(1)
-- Iteration 14 --
float(0)
-- Iteration 15 --
float(0)
-- Iteration 16 --
float(%f)
===Done===