????JFIF??x?x????'
| Server IP : 79.136.114.73  /  Your IP : 216.73.216.37 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 : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/math/  | 
Upload File :  | 
--TEST--
Test abs() function : usage variations - different data types as $number arg
--FILE--
<?php
/* Prototype  : number abs  ( mixed $number  )
 * Description: Returns the absolute value of number.
 * Source code: ext/standard/math.c
 */
/*
 * Pass different data types as $number argument to abs() to test behaviour
 */
echo "*** Testing abs() : usage variations ***\n";
//get an unset variable
$unset_var = 10;
unset ($unset_var);
// get a class
class classA
{
  public function __toString() {
    return "abs";
  }
}
// heredoc string
$heredoc = <<<EOT
abs
EOT;
// get a resource variable
$fp = fopen(__FILE__, "r");
// unexpected values to be passed to $number argument
$inputs = array(
       // null data
/*10*/ NULL,
       null,
       // boolean data
/*12*/ true,
       false,
       TRUE,
       FALSE,
       
       // empty data
/*16*/ "",
       '',
       array(),
       // string data
/*19*/ "abs",
       'abs',
       $heredoc,
       
       // object data
/*22*/ new classA(),
       // undefined data
/*23*/ @$undefined_var,
       // unset data
/*24*/ @$unset_var,
       // resource variable
/*25*/ $fp
);
// loop through each element of $inputs to check the behavior of abs()
$iterator = 1;
foreach($inputs as $input) {
	echo "\n-- Iteration $iterator --\n";
	var_dump(abs($input) );
	$iterator++;
};
fclose($fp);
?>
===Done===
--EXPECTF--
*** Testing abs() : usage variations ***
-- Iteration 1 --
int(0)
-- Iteration 2 --
int(0)
-- Iteration 3 --
int(1)
-- Iteration 4 --
int(0)
-- Iteration 5 --
int(1)
-- Iteration 6 --
int(0)
-- Iteration 7 --
int(0)
-- Iteration 8 --
int(0)
-- Iteration 9 --
bool(false)
-- Iteration 10 --
int(0)
-- Iteration 11 --
int(0)
-- Iteration 12 --
int(0)
-- Iteration 13 --
Notice: Object of class classA could not be converted to int in %s on line %d
int(1)
-- Iteration 14 --
int(0)
-- Iteration 15 --
int(0)
-- Iteration 16 --
int(%d)
===Done===