On Tuesday, October 14, 2003 1:10 PM, mailto:[EMAIL PROTECTED] wrote:

> You are pushing towards
>
>   $_~=/^\.*?\$$/;
>
> This is not human-readable code and one of the basic characteristics
> that sets PHP apart from Perl.

Actually, I'm pushing towards

if (! ($_REQUEST['email'] =~ '/[EMAIL PROTECTED]@([-a-z0-9]+\.)+[a-z]{2,}$/i')) {
   $form->addError('Please enter a valid e-mail address.');
}

There's not much we can practically do about the punctuation density of
regular expressions, but we can make their use more widespread by changing
the syntax of how they're invoked.

> Every non-trivial line of PHP code
> has a decypherable keyword that you can plug into the manual to
> figure out what that line is doing.

I think this is a great aspect of PHP.

> We make sure of this by keeping
> the number of operators to a minimum.  As for your bitshifting
> example.  It has nothing to do with the frequency of use, it has to
> do with readability.

So why is the === operator an operator and not an is_identical() function?

My motivation for this operator is to encourage regular expression use as
part of the core toolbox of PHP programmers. I think, especially in a web
context, where so much work has to do with data validation and manipulation,
that this is a reasonable goal. The features that the preg_* functions
provide are great -- I think we should explore ways to have an operator
syntax for regular expressions.

David

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to