????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 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/general_functions/ |
Upload File : |
--TEST--
Test is_resource() function : basic functionality
--FILE--
<?php
/* Prototype : bool is_resource ( mixed $var )
* Description: Finds whether a variable is a resource
* Source code: ext/standard/type.c
*/
echo "*** Testing is_resource() : basic functionality ***\n";
class Hello {
public function SayHello($arg) {
echo "Hello\n";
}
}
$vars = array(
false,
true,
10,
10.5,
"Helo World",
array(1,2,3,4,5),
NULL,
new Hello());
$types = array(
"bool=false",
"bool=true",
"integer",
"double",
"string",
"array",
"NULL",
"object");
echo "\nNon-resource type cases\n";
for ($i=0; $i < count($vars); $i++) {
if (is_resource($vars[$i])) {
echo $types[$i]. " test returns TRUE\n";
} else {
echo $types[$i]. " test returns FALSE\n";
}
}
$res = fopen(__FILE__, "r");
echo "\nResource type..var_dump after file open returns\n";
var_dump($res);
echo "Resource type..after file open is_resource() returns";
if (is_resource($res)) {
echo " TRUE\n";
} else {
echo " FALSE\n";
}
fclose($res);
echo "\nResource type..var_dump after file close returns\n";
var_dump($res);
echo "Resource type..after file close is_resource() returns";
if (is_resource($res)) {
echo " TRUE\n";
} else {
echo " FALSE\n";
}
?>
===DONE===
--EXPECTF--
*** Testing is_resource() : basic functionality ***
Non-resource type cases
bool=false test returns FALSE
bool=true test returns FALSE
integer test returns FALSE
double test returns FALSE
string test returns FALSE
array test returns FALSE
NULL test returns FALSE
object test returns FALSE
Resource type..var_dump after file open returns
resource(%d) of type (%s)
Resource type..after file open is_resource() returns TRUE
Resource type..var_dump after file close returns
resource(%d) of type (Unknown)
Resource type..after file close is_resource() returns FALSE
===DONE===