duan1443 2014-06-09 21:54
浏览 55
已采纳

在PHP中没有任何if等的花括号是什么意思[重复]

What do curley braces without any if,while,for etc before them mean in PHP? E.g.

#Code
{
   #Code
}
#Code
</div>
  • 写回答

1条回答 默认 最新

  • doushizhou4477 2014-06-09 21:58
    关注

    They do/mean precisely nothing - they are only used (very rarely, and usually inappropriately) as a developer aide.

    And, if anyone's wondering they don't affect variable scope either:

    -> cat foo.php 
    <?php
    
    $out = "yup";
    {
        echo "can access vars from outside? $out
    ";
    
        $in = "yup";
    }
    
    echo "can access vars from inside? $in
    ";
    
    -> php foo.php 
    can access vars from outside? yup
    can access vars from inside? yup
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化