Re: note 11883 added to language.expressions.php
| From: | Jesus M. Castagnetto | Date: | Mon, 12 Mar 2001 09:46:12 +0000 |
| Subject: | Re: note 11883 added to language.expressions.php | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-12293@lists.php.net to get a copy of this message | ||
Done, also edited this one to remove the request you
made to the editors.
--- yasuo_ohgaki@hotmail.com wrote:
> [To editors:
> Could you please delete my previous 2 notes? I think
> this notes would be just enough. Thank you]
>
> Manual defines "expression is anything that has
> value", Therefore, parser will give error for
> following code.
>
> ($val) ? echo('true') : echo('false');
> Note: "? : " operator has this syntax "expr ? expr
> : expr;"
>
> since echo does not have(return) value and ?:
> expects expression(value).
>
> However, if function/language constructs that
> have/return value, such as include(), parser
> compiles code.
>
> Note: User defined functions always have/return
> value without explicit return statement (returns
> NULL if there is no return statement). Therefore,
> user defined functions are always valid expressions.
>
> [It may be useful to have VOID as new type to
> prevent programmer to use function as RVALUE by
> mistake]
>
> For example,
>
> ($val) ? include('true.inc') : include('false.inc');
>
> is valid, since "include" returns value.
>
> The fact "echo" does not return value(="echo" is not
> a expression), is less obvious to me.
>
> Print() and Echo() is NOT identical since print()
> has/returns value and can be a valid expression.
>
>
>
http://www.php.net/manual/en/language.expressions.php
>
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto <jmcastagnetto@php.net>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/