缩短“If - Then - Else”? [英] Shortened "If - Then - Else"?

查看:85
本文介绍了缩短“If - Then - Else”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,


只是想知道在PHP中是否有缩写的If - Then - Else

格式,就像在JavaScript。


JavaScript允许使用以下格式的缩写版本:

([CONDITION]?[RESULT_THEN]:[RESULT_ELSE])


这种格式能够包含在

声明中的等号后面,例如:

var foo =(field1 =='' content''?''bar'':''foo'');


任何帮助都会受到赞赏 - 我只是想减少
的数量
详细和嵌套如果'... ...


谢谢

卢克

解决方案

2005年7月4日02:36:18 -0700, lu ***** @ gmail .com 写道:

只是想知道PHP中是否有缩写的If - Then - Else
格式,就像那个可能的那样用JavaScript编写。




你看过手册了吗?


-

Firefox浏览器 - 重新发现网页 - http://getffox.com/

Thunderbird电子邮件和新闻组 - http://gettbird.com/


<卢***** @ gmail.com>在消息中写道

news:11 ********************* @ g47g2000cwa.googlegro ups.com ...

只是想知道PHP中是否有缩写的If - Then - Else格式,就像在JavaScript中那样。
谢谢
Luke




使用源Luke;)我提供文档。


是的,您可以使用简短形式,与其他语言一样,简短

表单是表达式,而长表单是声明。


rush

-
http://www.templatetamer.com/
http://www.folderscavenger.com/


* ** Ewoud Dronkert写道/escribió(星期一,2005年7月4日11:42:54 +0200):

2005年7月4日02:36:18 -0700,陆***** @克mail.com 写道:

只是想知道PHP中是否有缩写的If - Then - Else
格式,就像在JavaScript中那样。


你看过手册了吗?




更具体地说:

http://es2.php.net/operators


我我总是想知道人们如何学习编程语言

甚至没有查看文档:)

-

- álvaro G. Vicario - 西班牙布尔戈斯

- http://bits.demogracia .com - Mi sitiosobreprogramaciónweb

- 不要给我发电子邮件给你我的问题,把它们发给小组

-


Hey All,

Just wondering whether there is an abbreviated "If - Then - Else"
format in PHP, much like that possible in JavaScript.

JavaScript allows an abbreviated version in the following format:
( [CONDITION]? [RESULT_THEN]: [RESULT_ELSE] )

This format is able to be included after the equal sign in a
declaration, such as:
var foo = ( field1==''content''? ''bar'': ''foo'' );

Any help would be appreciated - I''m just trying to reduce the number of
verbose and nested If''s...

Thanks
Luke

解决方案

On 4 Jul 2005 02:36:18 -0700, lu*****@gmail.com wrote:

Just wondering whether there is an abbreviated "If - Then - Else"
format in PHP, much like that possible in JavaScript.



Have you looked in the manual yet?

--
Firefox Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/


<lu*****@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...

Just wondering whether there is an abbreviated "If - Then - Else"
format in PHP, much like that possible in JavaScript.
Thanks
Luke



Use the source Luke ;) oups I ment documentation.

yes you can use short form, and in the same way as in other languages, short
form is expression while long one is statement.

rush
--
http://www.templatetamer.com/
http://www.folderscavenger.com/


*** Ewoud Dronkert wrote/escribió (Mon, 04 Jul 2005 11:42:54 +0200):

On 4 Jul 2005 02:36:18 -0700, lu*****@gmail.com wrote:

Just wondering whether there is an abbreviated "If - Then - Else"
format in PHP, much like that possible in JavaScript.



Have you looked in the manual yet?



More specifically:

http://es2.php.net/operators

I''ve always wondered how people manage to learn a programming language
without even looking at the documentation :)
--
-- álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don''t e-mail me your questions, post them to the group
--


这篇关于缩短“If - Then - Else”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆