使用php速记是不好的吗? [英] Is using php shorthands bad?

查看:101
本文介绍了使用php速记是不好的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
可以使用PHP短标签吗?

我正在学习php,并且(大约学习了6个月)在我正在学习的教程中,它使用的是php速记,所以当我在google上查询它时,我遇到了这个堆栈溢出问题 StackOverflow问题,其中一个流行的答案表示速记是不好的. >

我知道以下评论之一,然后暗示它还不错,但是我还记得在从php书中朗读之前,使用它们并不总是一件好事.所以我有点困惑,他们好不好?

解决方案

由于可移植性,通常这不是一个好主意.所有PHP配置都可以理解<?php ?>标记,但并非所有配置都可以使用<? ?>.

<? =$variable; ?>进行打印时也是如此.

Possible Duplicate:
Are PHP short tags acceptable to use?

I'm just learning php and (been learning for about 6 months) and in a tutorial that I'm going through, it's using php shorthands, so when I looked it up on google, I came to this stack overflow question StackOverflow question where one of the popular answers says that shorthands are bad.

I know one of the following comments then suggest that it's not bad but I also remotely remember reading from a php book before that it's not always good to use them. So I'm a bit confused, are they bad or not?

解决方案

It is generally a bad idea because of portability. All PHP configurations understand the <?php ?> tags, but not all are configured to use <? ?>.

Same thing goes for <? =$variable; ?> for printing.

这篇关于使用php速记是不好的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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