Home  >  Article  >  Backend Development  >  PHP data types and magic constants

PHP data types and magic constants

little bottle
little bottleforward
2019-04-16 15:16:532555browse

1.

1.boolean Boolean type

(Boolean value itself, integer type 0, floating point type 0.0, empty string, array not containing any elements, not including any Object of member variable

NULL, unassigned variable)

2.integer integer type

3.float floating point type

4.string character String

5.Array array

6.Object object

7.Resource resource type

Special for opening files, database connections, graphics canvas areas, etc. Handle

8.NULL

9.callback Callback type

2.

__LINE__The current line number in the file

__FILE_ _The full path and file name of the file

__DIR__The directory where the file is located

__FUNCTION__Returns the name when the function was defined (case-sensitive)

__CLASS__Returns the The name of the class when it was defined (case-sensitive)

_TRAIT__ returns the name of the trait when it was defined (case-sensitive). The Trait name includes the scope in which it is declared (e.g. Foo\Bar)

__METHOD__ Returns the name of the method when it was defined (case-sensitive)

__NAMESPACE__ The name of the current namespace (case sensitive)

[Recommended course: PHP video tutorial]

The above is the detailed content of PHP data types and magic constants. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete