I just reviewed my code and I realize that I never use
var
However I read
http://www.php.net/manual/en/keyword.class.php
and it seems to say that one should use var.
<?php
class Cart {
var $items; // Items in our shopping cart
....blah
}
?>
In this example what privacy is var set to.
For my purposes I just normally do:
private $some_var;
public $some_var;
protected $some_var;
What is best practice?
var is identical to public. BUT most modern coding standards prefer ‘public’ over var.
Howevever, there is no real difference at all.