'; ?> DomCore Demos, a WebAbility® Network Project
« Back to the index

\core\WAClass example

"; echo "DomCore version ".\core\WADebug::VERSION."
"; echo "HTML API ? ".(\core\WADebug::getHTMLAPI()?'Yes':'No')."
"; echo "OS Type ? ".(\core\WADebug::getOSType()==\core\WADebug::WINDOWS?'Windows':(\core\WADebug::getOSType()==\core\WADebug::UNIX?'Unix':'Mac'))."
"; echo "
"; class vehicle1 extends \core\WAClass { protected $speed; public function __construct($speed) { parent::__construct(); $this->speed = $speed; } protected function serial(&$data) { $data['speed'] = $this->speed; } protected function unserial($data) { $this->speed = $data['speed']; } } class vehicle2 extends \core\WAClass { protected $speed; public $speed1 = 80; private $speed2 = 250; public function __construct($speed) { parent::__construct(); $this->speed = $speed; } protected function serial(&$data) { $data['speed'] = $this->speed; $data['speed1'] = $this->speed1; $data['speed2'] = $this->speed2; } protected function unserial($data) { $this->speed = $data['speed']; $this->speed1 = $data['speed1']; $this->speed2 = $data['speed2']; } } $car1 = new vehicle1(100); print "CAR 1 DATA, SERIALIZATION AND COPY OF CAR 1:"; print "
"; print $car1->explain(); print "
"; $ser1 = serialize($car1); print $ser1; print "
"; $newcar1 = unserialize($ser1); print $newcar1->explain(); print "
"; $car2 = new vehicle2(200); print "CAR 2 DATA, SERIALIZATION AND COPY OF CAR 2:"; print "
"; print $car2->explain(); print "
"; $ser2 = serialize($car2); print $ser2; print "
"; $newcar2 = unserialize($ser2); print $newcar2->explain(); ?>



« Back to the index