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; & nbsp ;......} I tested it. it seems that var can only be used in the class. if it is used outside the class, an error occurs (what is the role of var declaration in PH 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