如果PHP中的(\ false)(是,带反斜杠)是什么意思? [英] What does mean if (\false) (yes, with backslash) in PHP?
问题描述
今天早上,我收到通知,新的 Twig_Extensions 版本已经发布!是的!
This morning, I've been notified that a new Twig_Extensions release is available! Yay!
在将其集成到 twigfiddle 之前,我想看看 class_alias
函数为名称空间添加支持,然后添加仅包含旧版的PSR-4对应类.
Before integrating it to twigfiddle, I wanted to see changes. This is mainly adding support to namespaces using class_alias
function, and then add PSR-4 correspoding classes that just include the legacy one.
但是每个新的(命名空间)类都是这样实现的:
But each new (namespaced) classes are implemented like this:
<?php
namespace Twig\Extensions;
require __DIR__.'/../lib/Twig/Extensions/Extension/Text.php';
if (\false) {
class TextExtension extends \Twig_Extensions_Extension_Text
{
}
}
此表示法是什么意思?
推荐答案
这表示它使用的是全局命名空间中定义的false..
It means it's using the false defined in the global namespace..
经过一番研究,结果发现剩下的答案毫无意义……我发誓您能够在某个时间点用PHP做到这一点.
After a bit of research it turns out the rest of this answer is nonesense... I could swear you were able to do this in PHP at one point in time.
我认为这是可以解决的情况
I think this is get around the situation where
<?php
namespace whywouldyoudothis;
false = true;
?>
我从未见过有人为此编写过代码,但这就是我的初衷.
I have never ever seen anyone code for this but that's what springs to mind.
这篇关于如果PHP中的(\ false)(是,带反斜杠)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!