Re: comparable Perl "unless" in PHP?
| From: | Thomas Deliduka | Date: | Thu, 02 Nov 2000 20:13:52 +0000 |
| Subject: | Re: comparable Perl "unless" in PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23449@lists.php.net to get a copy of this message | ||
I'm not the greatest of programmers but you could just make a negative If
statement:
If (!$login....)
or
if (!$field1 && !$field2 && !$field3 && !$field4 && !$field5)
would this work?
On 11/2/00 1:54 PM this was written:
> 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 ;)
--
Thomas Deliduka
IT Manager
-------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/