What is the role of var declaration in php? PHP has just learned, but even if the PHP Bible involves a wide range of teaching materials, it does not mention that PHP can use var to declare variables, but read a book class on the Internet, VAR is used to declare the variable. For example: classtest {& nbsp; var $ a; & nbsp; var $ B; & n what is the role of var declaration in php?
PHP has just learned, but even if the PHP Bible involves a wide range of teaching materials, it does not mention that PHP can use var to declare variables, but read a book class on the Internet, VAR is used to declare the variable. For example:
Class test {
Var $;
Var $ B;
......
}
I tested it. it seems that var can only be used in the class. if it is used outside the class, an error occurs (PHP5.3 ).
Which of the following functions can be summarized?
------ Solution --------------------
In PHP5, public is equivalent to var.
It is only for compatibility with PHP4, so var is retained
------ Solution --------------------
Forward compatibility
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.