All In One Script
MENU

What is the difference between public, private, and protected?

by 3:39:00 AM
undefined
What is the difference between public, private, and protected? When and why should I use public, private, and protected functions and variables inside a class? What is the difference between them? Examples: // Public public $variable; public function doSomething() { // ... } // Private private $variable; private function doSomething() { // ... } // Protected protected $variable; protected function doSomething() { // ... } Solution :  You use: public scope to make that variable/function available from anywhere, other classes and instances of the object. private scope when you

How should a model be structured in MVC?

by 4:45:00 AM
undefined
How should a model be structured in MVC? I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this: public function CheckUsername($connection, $username) { try { $data = array(); $data['Username'] = $username; //// SQL $sql = "SELECT Username FROM" . $this->usersTableName . " WHERE Username = :Username"; //// Execute statement return $this->ExecuteObject($connection, $sql, $data); } catch(Exception $e) { throw

Instagram