why can't you just use plan simple HTML to do it??? rather than make a larger hassle 
for your self ie

<strong> howdy </strong> ??? 

& yes that is valid HTML :)

Peter

-----Original Message-----
From: Dr. Evil [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 10:27 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Strong typing?



> Ummmm... you could write a fuction like
> 
> function CheckInputAgainstRE( $val, $re )
> {
>      if ( ! ereg( $re, $val ) )
>      {
>          ( ... some kind of code that writes out an error message and dies 
> ... )
>      }
>      return $val;
> }

That's what I've done.  I have a huge file full of all kinds of data
checking functions.  However, what if I forget to call one of them, or
one doesn't work the way I expect it to?  Strong typing means that the
script will just die, instead of possibly passing the wrong values
into the SQL query.  This is exactly the same reason why perl has a
strict mode.  Sure you could write a lot of input checking functions
(which you will have to do no matter what) but you should have
constraints built into your data structures.

It's just like with SQL: if you know that a certain value in a table
has a certain constraint ("a withdrawal must always be greater than
zero") then you should put that constraint into your table definition,
so that an error somewhere else will be limited in its effects.

If you're doing financial stuff, or anything else that requires
bullet-proof security and reliability, strong typing is essential, in
addition to checking all the user input.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to