Re: [PHP] Re: why doesn't default values for this function work

2003-08-14 Thread anders thoresson
Change your logic here... if($max_length == -1) then you did not send a value for $max_length and act accordingly. or if(!($max_length == -1)) you did send a $max_length value and act accordingly. But I want to make the same things, with some additions if $max_length is set. That's why I

Re: [PHP] Re: why doesn't default values for this function work

2003-08-14 Thread CPT John W. Holmes
From: anders thoresson [EMAIL PROTECTED] I want the $max_length to be optional. With your solution it isn't? I thought I could make it optional by assigning a default value of -1, which would tell the function not to bother with max_length and continue the execution. All in all my function

Re: [PHP] Re: why doesn't default values for this function work

2003-08-14 Thread anders thoresson
function secure_string($unsafe_string, $max_length) { if(!is_int($max_length)) error(Variable max_length is not an integer. ); if (strlen($unsafe_string) $max_length) error(Too many characters.); } I want the $max_length to be optional. With your solution it isn't? I thought I could make it