Thread: Custom Classes!
View Single Post
  #19  
Old 12-09-2007, 10:53 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Inverness View Post
Too complex for average use.
But Powerful for those who know how to use it. Additionally, the merger comes with a default way of merging. It isn't necessary to define your own function, but the power is there if you do!

PHP Code:
function onCreated()
{
  
mod1 = TMap.newInstance({{"a",3}, {"b", 1}} );
  
mod2 = TMap.newInstance({{"a",2}, {"b", 1}, {"c", 1}} );

  
mod3 = TMap.merge( mod1, mod2 );
  echo( 
mod3.toArray() ); // "a,5","b,2","c,1"
} 
Simple for those who don't need more.
Reply With Quote