Location: PHPKode > scripts > Overload > overload/Help.txt
You just need multiple (protected!) functions in your class with the special signature to work with them in an object as known from JAVA etc.

There are 7 types that you can vary:
	B - Boolean
	I - Integer / Long
	F - Float / Double
	S - String
	A - Array
	O - Object
	R - Ressource
 
Just add these letters after an underline character ("_") to define the signature of the function. All functions have to be protected!

Here is an example:
 
	class Example extends Overload
 	{
	  	protected function foo()
	  	{
	  		return NULL;
	  	}
	  
	  	protected function foo_S($string)
	 	{
	  		echo $string;
	  	}
	  
	  	protected function foo_SI($string, $integer)
	  	{
	  		echo
				$string . " equals " . $integer . ".";
	  	}
	}
  
Now you can call just "foo" with different signatures:
  
	$o = new Example();
	$o->foo()					// Will call foo()
	$o->foo("Hello World!");	// Will call foo_S("Hello World!")
	$o->foo("Pi", 3);			// Will call foo_SI("Pi", 3)

	$o->foo(3, "Pi");			// Will lead to an error because there is no
								   function with foo_IS
	$o->foo($o, 1);				// Will lead to an error because there is no
								   function with foo_OI

NOTE: It only works in objects / non-static functions.
Return current item: Overload