PHP - If/else, for, foreach, while - without curly braces?

后端 未结 12 1657
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 05:31

Something that really would like to know but never found out are shortcuts in PHP.

I am currently coding a function with a foreach loop with just a sing

12条回答
  •  情歌与酒
    2020-11-27 06:15

    There are places where you can, but you never should.

    Explicit is always better than implicit.

    Who knows when you're going to have to go back and modify old code. It's so easy to miss that stuff and there's nothing gained by doing it.

提交回复
热议问题