title image


Smiley Re: include() von fremder Domain


<?



class Foo {

// The properties array

var $array = array('a' => 1, 'b' => 2, 'c' => 4);



// Getter

function __get($n, $val = "") {

if (phpversion() >= 5) {

return $this->array[$n];

} else {

$val = $this->array[$n];

return true;

}

}



// Setter

function __set($n, $val) {

$this->array[$n] = $val;

if (phpversion() < 5) return true;

}



// Caller, applied when $function isn't defined

function __call($function, $arguments) {

// Constructor called in PHP version < 5

if ($function != __CLASS__) {

$this->$arguments[0] = $arguments[1];

}

if (phpversion() < 5) return true;

}

}



// Call the overload() function when appropriate

if (function_exists("overload") && phpversion() < 5) {

overload("Foo");

}



// Create the object instance

$foo = new Foo;



// Adjust the value of $foo->array['c'] through

// method overloading

$foo->set_array('c', 3);



// Adjust the value of $foo->array['c'] through

// property overloading

$foo->c = 3;



// Print the new correct value of $foo->array['c']

echo 'The value of $foo->array["c"] is: ', $foo->c;



?>








Gruß Stefan

www.triess.de - Meine Themen: Consulting Forschung Entwicklung Projektierung Elektronik Software Mechanik Verfahren Messverfahren Kommunikation Navigation Map Matching Location Based Services Telematik komplexe Test- und Demonstrationssysteme GPS BS26 ISDN X.25 X.31 GSM GPRS UMTS DSL TCP/IP ACP SPS PC LAN WAN Feldbus Internet/Intranet Webdesign SQL Client/Server RedOx LF pH rF


geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: