Re: return parse error
| From: | Yasuo Ohgaki | Date: | Fri, 13 Apr 2001 08:29:44 +0000 |
| Subject: | Re: return parse error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48423@lists.php.net to get a copy of this message | ||
"or" requires expression. "return" is not a expression.
That why you get parse error.
Regards,
--
Yasuo Ohgaki
""Peter Harkins"" <ph@malaprop.org> wrote in message
news:75b9123bacd3da880b4f1694dce32cf0@news.php.net...
> This generates a parse error:
> mysql_connect("localhost", "root", "rootpw") or
> return("bar");
>
> But all the following work fine:
> mysql_connect("localhost", "root", "rootpw") or
> die("bar");
>
> mysql_connect("localhost", "root", "rootpw") or
> print("bar");
>
> if (!mysql_connect("localhost", "root", "rootpw")) {
> return("bar");
> }
>
> Why? mysql_connect returns false on failure either way... I notice die
>
> and print are functions but return seems not to be, it doesn't have a
> 'function.[name].html' file in the manual. *scratches head* I can't see
>
> any reason in the manual for this behavior. Am I missing something?
>
> PHP is running on Linux 2.2.19 and identifies as '4.0.2'. phpinfo also
> says:
> './configure' '--with-mysql' '--with-apache=../apache_1.3.12'
> '--
> enable-track-vars' '--disable-debug' '--disable-xml'
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>