I’m trying to abstract one of my php scripts into a class, and I keep getting nonsense errors. I have experience in AS3 OOP, but this is so simple yet so broken. Here’s the class:
<?php
class DBModel {
private $dbc;
private $table;
public function __construct($new_dbc, $new_table) {
$this->$dbc = "something";
echo "Made DBModel:" . $new_dbc . $new_table;
}
}
?>
… and the script that instantiates it:
<?php
require_once ('classes/dbmodel.php');
$db_model = new DBModel('string','Number');
unset($dbc);
?>
… and the error.
Fatal error: Cannot access empty property in /home2/appalac7/public_html/classes/dbmodel.php on line 9
I’m running php 5.2, so I know it’s not version problems. Thanks.