Code: Select all
<?php
class Bookmark {
const NEW_BOOKMARK = -1;
protected $id = Bookmark::NEW_BOOKMARK;
protected $conn;
public $url;
public $name;
public $description;
public $tag;
public $created;
public $updated;
const SELECT_BY_ID = 'select * from bookmark where id = ?';
public function __construct($id=false, $conn=false) {
$this->conn = ($conn) ? $conn : DB::conn();
if ($id) {
$rs = $this->conn->execute(
self::SELECT_BY_ID
,array((int)$id));
// ....
?>So what do you think about the use of class constants? Is there a reason I don't see them a lot? Are there drawbacks/advantages of using them?