Speed Test    Top 25 Hosts    Hosting Reviews    100 Hosts
GalaxyVisions - Ultimate Web Hosting Solutions

Dedicated servers
& web hosting directory

IAAS Platform
Advance Search    Dedicated Servers   Company Name   HostMatch
Thank you for visiting this site. If you are looking for web hosting services, you have come to the right place. Please search my database of over 2400 hosting companies.

If you need any help, please email me at terence @ hostpulse.com . I will personally try to reply your email within a day and give you some basic guidelines, negotiate with a few hosts to offer you good pricing or answer any hosting related problems that you may have. 
Cheap Web Hosting ASP & ASP.Net Hosting

Dedicated Server

Windows Server Hosting Ecommerce Hosting PHP Hosting
Linux & Unix Hosting Cold Fusion Hosting South America
Europe Reseller Hosting Managed Hosting
Virtual Private Server Asia Pacific Search by Country

Reference and Manual


Hosting Glossary  PHP  HTML 4.01  CSS 2.0  Core Javascript 1.5  XHTML 1.0

Overloading

Overloading

Both method calls and member accesses can be overloaded via the __call, __get and __set methods. These methods will only be triggered when your object or inherited object doesn't contain the member or method you're trying to access.

Member overloading

void __set ( string name, mixed value)

void __get ( mixed name)

Class members can be overloaded to run custom code defined in your class by defining these specially named methods. The $name parameter used is the name of the variable that should be set or retrieved. The __set() method's $value parameter specifies the value that the object should set set the $name.

Example 18-16. overloading with __get and __set example

<?php
class Setter {
  
public $n;
  
private $x = array("a" => 1, "b" => 2, "c" => 3);

  function
__get($nm) {
    print
"Getting [$nm]\n";

    if (isset(
$this->x[$nm])) {
      
$r = $this->x[$nm];
      print
"Returning: $r\n";
      return
$r;
    } else {
      print
"Nothing!\n";
    }
  }

  function
__set($nm, $val) {
    print
"Setting [$nm] to $val\n";

    if (isset(
$this->x[$nm])) {
      
$this->x[$nm] = $val;
      print
"OK!\n";
    } else {
      print
"Not OK!\n";
    }
  }
}

$foo = new Setter();
$foo->n = 1;
$foo->a = 100;
$foo->a++;
$foo->z++;
var_dump($foo);
?>

Will output:

Setting [a] to 100
OK!
Getting [a]
Returning: 100
Setting [a] to 101
OK!
Getting [z]
Nothing!
Setting [z] to 1
Not OK!
object(Setter)#1 (2) {
  ["n"]=>
  int(1)
  ["x:private"]=>
  array(3) {
    ["a"]=>
    int(101)
    ["b"]=>
    int(2)
    ["c"]=>
    int(3)
  }
}

Method overloading

mixed __call ( string name, array arguments)

Class methods can be overloaded to run custom code defined in your class by defining this specially named method. The $name parameter used is the name as the function name that was requested to be used. The arguments that were passed in the function will be defined as an array in the $arguments parameter. The value returned from the __call() method will be returned to the caller of the method.

Example 18-17. overloading with __call example

<?php
class Caller {
  
private $x = array(1, 2, 3);

  function
__call($m, $a) {
    print
"Method $m called:\n";
    
var_dump($a);
    return
$this->x;
  }
}

$foo = new Caller();
$a = $foo->test(1, "2", 3.4, true);
var_dump($a);
?>

Will Output:

Method test called:
array(4) {
  [0]=>
  int(1)
  [1]=>
  string(1) "2"
  [2]=>
  float(3.4)
  [3]=>
  bool(true)
}
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}

Web Hosting Showcase
View the web hosting showcase to find more relevant web hosting choice that will guide you in selecting a good web hosting company.
 

GalaxyVisions - Ultimate Web Hosting Solutions Cheap Web Hosting ASP & ASP.Net Hosting Dedicated Servers
Windows 2000 & 2003 Server Hosting Ecommerce Hosting PHP Hosting
Linux & Unix Hosting Cold Fusion Hosting South America
Europe Reseller Hosting Managed Hosting
Virtual Private Server Asia Pacific  

Web Hosting and Development Tools

Network Tools  Download Template  Programming Manuals  Developer Tools

  











Hosts we like
ApolloHosting
ActiveHost
Cravis
Galaxyvisions.com
Whosbehindyourwebsite
Olm.net



Net Host Tools

Feature Host







This site provide free reviews of web hosting services from 100 selected companies. There are over 3000 over website hosting companies on the internet. Please research these domain hosting services carefully before you sign up with any. Read articles on web page hosting, web site hosting, domain names, website speed test, cheap web hosting services, PHP scripts, mysql database, asp hosting and virtual private server to gain a better knowledge on domain hosting and cheap web hosting.



Learn more about us
About HostPulse
Contact Us Terms of Use


©2011
All rights reserved.

Questions? Comments? Get started
Affordable Advertising | Host Login & Register
Submission
Submit a news |
Web Hosting and Development Tools
Network Tools  Download Template  Programming Manuals  Search by Country   Links to other sites