PHP variable judgment

Source: Internet
Author: User
PHP variable judgment

Is_a -- returns TRUE if the object belongs to this class or the class is the parent class of this object.

Bool is_a (object, string class_name)
If the object is the class or the class is the parent class of this object, TRUE is returned; otherwise, FALSE is returned.

Is_array -- check whether the variable is an array

Bool is_array (mixed var)

If var is array, TRUE is returned; otherwise, FALSE is returned.

Is_bool -- check whether the variable is Boolean
Bool is_bool (mixed var)
Returns TRUE if var is boolean.

Is_callable -- check whether the parameter is a valid callable structure
Bool is_callable (mixed var [, bool syntax_only [, string callable_name])

Is_dir -- determine whether the specified file name is a directory
Bool is_dir (string filename)
Returns TRUE if the file name exists and is a directory. If filename is a relative path, check its relative path according to the current working directory.

Is_double -- is_float () alias

Is_executable -- determines whether a given file name can be executed
Bool is_executable (string filename) returns TRUE if the file exists and can be executed.

Is_file -- determine whether a given file name is a normal file
Bool is_file (string filename) returns TRUE if the object exists and is normal.

Is_finite -- determine if it is a finite value
Bool is_finite (float val) returns TRUE if val is a valid finite value in the range allowed by the PHP floating point on the local platform.

Is_float -- check whether the variable is floating-point
Bool is_float (mixed var) returns TRUE if var is float, otherwise FALSE.
Note: To test whether a variable is a numeric or numeric string (such as form input, which is usually a string), you must use is_numeric ().

Is_infinite -- determines if it is an infinite value
Bool is_infinite (float val) if val is infinite (positive or negative), for example, log (0) results or any value beyond the floating point range of the platform, TRUE is returned.

Is_int -- check whether the variable is an integer
Bool is_int (mixed var) returns TRUE if var is an integer; otherwise, FALSE.
Note: To test whether a variable is a numeric or numeric string (such as form input, which is usually a string), you must use is_numeric ().

Is_integer -- alias of is_int ()

Is_link -- determine whether a given file name is a symbolic connection
Bool is_link (string filename) returns TRUE if the file exists and is a symbolic connection.

Is_long -- alias of is_int ()

Is_nan -- determine whether it is a valid value
Bool is_nan (float val) if val is "non-numeric", for example, the result of acos (1.01), TRUE is returned.

Is_null -- check whether the variable is NULL
Bool is_null (mixed var) returns TRUE if var is null; otherwise, FALSE.

Is_numeric -- checks whether the variable is a numeric or numeric string
Bool is_numeric (mixed var) returns TRUE if var is a numeric or numeric string; otherwise, FALSE.

Is_object -- check whether the variable is an object
Bool is_object (mixed var) returns TRUE if var is an object; otherwise, FALSE.

Is_readable -- determine whether the given file name is readable
Bool is_readable (string filename) returns TRUE if the object exists and is readable.
Remember, PHP may only use the user name (usually 'nobody') that runs webserver to access the file. Not included in security mode restrictions

Is_real -- alias of is_float ()

Is_resource -- check whether the variable is of the resource type
Bool is_resource (mixed var) if the given parameter var is of the resource type, is_resource () returns TRUE; otherwise, FALSE.

Is_scalar -- checks whether the variable is a scalar.
Bool is_scalar (mixed var) if the given variable parameter var is a scalar, is_scalar () returns TRUE; otherwise, FALSE.

Is_string -- check whether the variable is a string
Bool is_string (mixed var) returns TRUE if var is string; otherwise, FALSE.

Is_subclass_of -- returns TRUE if this object is a subclass of this class.
Bool is_subclass_of (object, string class_name)
If the object belongs to a subclass of class class_name, TRUE is returned; otherwise, FALSE is returned.

Is_uploaded_file -- determines whether the file is uploaded through http post.
Bool is_uploaded_file (string filename)
If the file given by filename is uploaded through http post, TRUE is returned. This can be used to prevent malicious users from spoofing scripts to access files that cannot be accessed, such as/etc/passwd. This check is especially important. if the uploaded file may display the content to the user or other users in the system. To enable the is_uploaded_file () function to work normally, a variable similar to $ _ FILES ['userfile'] ['tmp _ name'] must be specified, the file name $ _ FILES ['userfile'] ['name'] uploaded from the client does not work properly.

Is_writable -- determines whether a given file name can be written
Bool is_writable (string filename) returns TRUE if the file exists and can be written. The filename parameter can be a directory name that allows write check.
Remember, PHP may only use the user name (usually 'nobody') that runs webserver to access the file. This parameter is not included in the security mode.

Is_writeable -- is_writable () alias

Isset -- check whether the variable is set
Bool isset (mixed var [, mixed var [,...])
If var exists, TRUE is returned; otherwise, FALSE is returned.
If unset () is used to release a variable, it will no longer be isset (). If you use isset () to test a variable that is set to NULL, FALSE is returned. Note that a NULL byte ("\ 0") is not equivalent to the NULL constant of PHP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.