From a466136fe7072d13d4ab2f95b278f043c269eafc Mon Sep 17 00:00:00 2001 From: Zak Greant Date: Sat, 23 Jun 2001 17:26:18 +0000 Subject: [PATCH] Added note to intval. var argument should be a string if used in conjunction with the optional base argument git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@50051 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/var.xml | 77 ++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/functions/var.xml b/functions/var.xml index 773c7dbda2..27a605e099 100644 --- a/functions/var.xml +++ b/functions/var.xml @@ -58,16 +58,16 @@ print $double_value_of_var; // prints 122.34343 - This is the opposite of + This is the opposite of (boolean) var, except that no warning is generated when the variable is not set. - See converting + See converting to boolean for more information. - + - + $var = 0; @@ -165,7 +165,7 @@ if (!isset($var)) { // evaluates false gettype on a function. - See also + See also settype, is_array, is_bool, @@ -247,7 +247,7 @@ print_r(array_keys(get_defined_vars())); This function returns a string representing the type of the resource - passed to it. If the paramater is not a valid resource, it + passed to it. If the paramater is not a valid resource, it generates an error. @@ -290,9 +290,16 @@ echo get_resource_type($doc->doc)."\n"; base 10). - Var may be any scalar type. You cannot use + var may be any scalar type. You cannot use intval on arrays or objects. + + + The base argument for + intval has no effect unless the + var argument is a string. + + See also doubleval, strval, settype and @@ -331,7 +338,7 @@ echo get_resource_type($doc->doc)."\n"; - + is_bool @@ -346,13 +353,13 @@ echo get_resource_type($doc->doc)."\n"; bool is_bool - mixed + mixed var - Returns true if the var parameter is + Returns true if the var parameter is a boolean. @@ -649,7 +656,7 @@ echo get_resource_type($doc->doc)."\n"; - + is_resource @@ -661,28 +668,28 @@ echo get_resource_type($doc->doc)."\n"; Description - bool + bool is_resource - mixed + mixed var is_resource returns true if the variable - given by the var parameter is a resource, + given by the var parameter is a resource, otherwise it returns false. Resources are things like file or database result handles that are allocated and freed by internal PHP functions and that may need some cleanup when they are no longer in use but haven't been - freed by user code. + freed by user code. - + is_scalar @@ -694,17 +701,17 @@ echo get_resource_type($doc->doc)."\n"; Description - bool + bool is_scalar - mixed + mixed var is_scalar returns true if the variable - given by the var parameter is a scalar, + given by the var parameter is a scalar, otherwise it returns false. @@ -790,7 +797,7 @@ show_var($proteins) - + isset @@ -811,9 +818,9 @@ show_var($proteins) If a variable has been unset with unset, it will no longer be isset. isset - will return false if testing a variable that has been + will return false if testing a variable that has been set to NULL. Also note that a null byte ("\0") - is not equivalent to the PHP NULL constant. + is not equivalent to the PHP NULL constant. $a = "test"; @@ -822,8 +829,8 @@ echo isset ($a); // TRUE unset ($a); echo isset ($a); // FALSE -$foo = NULL; -print isset ($foo); // FALSE +$foo = NULL; +print isset ($foo); // FALSE @@ -877,10 +884,10 @@ print_r ($a); - This function will continue forever if given an array or object - that contains a direct or indirect reference to itself or that + This function will continue forever if given an array or object + that contains a direct or indirect reference to itself or that contains an array or object on a deeper level that does so. - This is especially true for print_r($GLOBALS), + This is especially true for print_r($GLOBALS), as $GLOBALS is itself a global variable and contains a reference to itself as such. @@ -956,7 +963,7 @@ if (!odbc_execute ($stmt, &$sqldata)) { - + settype @@ -987,7 +994,7 @@ if (!odbc_execute ($stmt, &$sqldata)) { - Returns TRUE if successful; otherwise returns + Returns TRUE if successful; otherwise returns FALSE. @@ -1180,9 +1187,9 @@ bar was called. -function foo(&$bar) { - unset($bar); - $bar = "blah"; +function foo(&$bar) { + unset($bar); + $bar = "blah"; } $bar = 'something'; @@ -1206,7 +1213,7 @@ something static variable, rather than the static variable itself. -function foo() { +function foo() { static $a; $a++; echo "$a\n"; @@ -1233,7 +1240,7 @@ foo(); function foo() { - unset($GLOBALS['bar']); + unset($GLOBALS['bar']); } $bar = "something"; @@ -1252,7 +1259,7 @@ foo(); - + var_dump