shorthand with ~
| From: | John N. | Date: | Sun, 07 Mar 2004 06:03:27 +0000 |
| Subject: | shorthand with ~ | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-23759@lists.php.net to get a copy of this message | ||
To whom it may concern:
I was working on a program for a client tonight, and realized that a lot of my function uses are
usually pretty long if they have multiple conditions in which the function is used repeatedly. You
might consider adding a shorthand way of adding multiple conditions (for this example, in an if
statement):
An example of this:
if( ! ereg( "PHPSESSID","$KEY" ) and ! ereg(
"poc_theme","$KEY" ) and ! ereg( "mode","$KEY" ) and ! ereg(
"question","$KEY" ) ) {
Could be shortened to:
if( ! ereg(
"PHPSESSID","$KEY"~"poc_theme","$KEY"~"mode","$KEY"~"question","$KEY")
) {
This would save a small amount of space and a little bit of bandwidth, but anything helps when
you've got a high-volume website.
What I did was this: In the function "ereg", I entered one condition, then allowed for the
entering of another one by putting a tilde between each one. I Thought about other symbols that
could be used, but I think ~ is the only one that's not in use at the moment.
Thanks for the taking the time to read this.
<>< john nicely