$required = array($name, $address, $phone);
foreach($required as $value)
{       if (!$value) echo("You left one empty.");
}


well that's how I'd do exactly that, although if you know the variables then
why not just...

if (!$name || !$address || !$phone) echo("You left one empty");

that's quicker, unless you need the values in a hash list for some other
reason.

Tim

----------
        From:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
        Sent:  20 November 2001 22:10
        To:  [EMAIL PROTECTED]
        Subject:  How do I convert from perl to php?

        I am a perl user trying to convert to php

        how would i turn this perl into php?

        use CGI;

        $name = param(name);
        $address = param(address);
        $phone = param(phone);

        @required = qw( name address phone );

        foreach $key($required)
        {
         if (!$$key) { &out("You left one empty."); }
        }

        ??


        ---------------------------------------------
        This message was sent using OlyPen's WebMail.
        http://www.olypen.com


        The original message was received at Tue, 20 Nov 2001 14:05:28 -0800
        from mail.olypen.com [208.200.248.2]

           ----- The following addresses had permanent fatal errors -----
        <[EMAIL PROTECTED]>
            (reason: 550 Host unknown)

           ----- Transcript of session follows -----
        550 5.1.2 <[EMAIL PROTECTED]>... Host unknown (Name server:
lists.php.ne: host not found)<<File: ATT27355.TXT>><<Message: Converting
from being a perl user>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to