Login   Register  
PHP Classes
elePHPant
Icontem

File: example_unrestricted_access

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Costin Trifan  >  Safe Object  >  example_unrestricted_access  >  Download  
File: example_unrestricted_access
Role: Example script
Content type: text/plain
Description: Example page
Class: Safe Object
Dynamically restrict the access to class variables
Author: By
Last change:
Date: 4 years ago
Size: 672 bytes
 

Contents

Class file image Download
<?php
/*
*  RestrictedAccess(false)
*---------------------------------
* Properties can be added at run-time
*/

class Test extends SafeObject
{
    public function 
DoSomething() { echo 'Doing something...'; }
    public function 
DoSomethingElse() { echo 'Doing something else...'; }
}

$o = new Test();

$o->RestrictedAccess(false);


echo 
'<br/>RestrictedAccess(false)<br/>-------------------------------<br/>';


// ok
$o->server 'localhost';
echo 
'<br/>server: ' $o->server;

// ok
$o->username 'costin';
echo 
'<br/>username: ' $o->username;

// ok
unset($o->username);

// ok
$o->test 'test';
echo 
'<br/>test: ' $o->test;

?>