CakePHP-2.0 has this=>
// Even in your cakephp 2.1.x we have this format
<?php
class PostsController extends AppController {
public $helpers = array ('Html','Form');
public $name = 'Posts';
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}
?>
CakePHP-1.3.10 had this=>
<?php
class PostsController extends AppController {
var $helpers = array ('Html','Form');
var $name = 'Posts';
function index() {
$this->set('posts', $this->Post->find('all'));
}
}
?>
What’s the difference between using public and using var ?
varis a deprecated visibility keyword that is functionally equal topublic.From the docs:
As it’s been replaced by the keyword
public, the new cake is following the new standard. See working example here.