note 39058 deleted from language.oop by sniper
| From: | sniper@php.net | Date: | Thu, 22 Jan 2004 00:45:12 +0000 |
| Subject: | note 39058 deleted from language.oop by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63992@lists.php.net to get a copy of this message | ||
Note Submitter: Andrew Eddy
----
A quick note, Here's an example of a class I made that used a function to pass back a value to
a variable, it happens to be an array but you can use ints and strings just as well
<?
class tadmin{
var $access;
var $user_id;
function tadmin()
{
$this->access = $this->get_access();
$this->user_id = $_SESSION['id'];
}
function get_access()
{
$sql = "SELECT permissions FROM users WHERE id = $this->user_id LIMIT 1";
$result = mysql_query($sql) or die("Can not get permissions");
$row = mysql_fetch_object($result);
$this->access = preg_split("/ /", $row->permissions);
return $this->access;
}
}
?>