View Single Post
Old 02-27-2008, 06:32 PM   #9 (permalink)
abiko
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default

It is a good solution in Python, but if you want this in PHP you're good to go with arrays like Alan said.
Also the same thing could be used in Javascript for defining some atribute (Umm - Prototype -
Code:
Effect.toggle( 'id', 'effect', {'duration':'1'} );
Like you said your function
Code:
function textDecoration( $font, $size, $underlined = false, $strikethrough = false );
PHP Code:
function textDecoration $fontOption$styleOption );
// -->
function textDecoration( array( 'font' => 'Arial'
                                
'size' => '12'
                               
), array( 'underlined' ) ); 
so you just check if size isn't specified - you set the default value for it.
If underlined specified - underline, if not - don't.

I mean you get the picture.
Hope I helped.
Thanx to Alan :)
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko is offline  
Reply With Quote