comparable Perl "unless" in PHP?

From: Date: Thu, 02 Nov 2000 18:54:13 +0000
Subject: comparable Perl "unless" in PHP?
Groups: php.general 
Request: Send a blank email to php-general+get-23442@lists.php.net to get a copy of this message
hi there - as a recent migrant form Perl to PHP I've been going crazy trying to figure out how to use Perl's "unless" statement in PHP - or at least a workaround. For example, with Perl I was able to restrict access to certain pages using something like this: $login = $ENV{REMOTE_USER}; unless ($login =~ /^foo$|^bar$/) { print $query->redirect("../no_access.html"); } or - If I had a form with many fields I could do something to the effect of unless ($field1 && $field2 && $field3 && $field4 && $field5) { print "you did not complete all fields.\n"; } can someone please enlighten me as to how I could achieve this same functionality within PHP? I've searched through several books to no avail - the only thing I could find remotely similar was the "isset" function but that only seems to work with a single value and not groups. Any help would be greatly appreciated. I'd hate to have to go back to Perl so soon in the game ;) Brian

« previous php.general (#23442) next »