Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Some help

Name: Anonymous 2009-09-08 0:50

I had an idea of using the switch() function in PHP to switch the arguments inside of a function. Only thing is, it doesn't really work, and I am not sure why.

function VALIDATE_($value)
        {
        switch ($value) {
            case $user:
                return preg_match('/^[A-Z0-9]{2,20}$/i', $username);
                break;
            case $mail:
                return filter_var($email, FILTER_VALIDATE_EMAIL);
                break;
            }
        }


I am sure you can see what I am trying to do. I want it to work so that whenever I change $value to $user or $email the output is different depending on which I use.

But whenever I use VALIDATE_($mail);, it always uses the first case. Anyone have an idea on how I can fix this?

Name: Anonymous 2009-09-08 1:01

case $mail
whenever I change $value to $user or $email
Does this have anything to do with it?

If not you may want to pastebin.com post the whole file that you're having problems with.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List