How to create loop templates in php

后端 未结 4 1486
清酒与你
清酒与你 2021-02-19 00:56

As we can define loop templates in C++, for making coding shorter:

#define fo(a,b,c) for( a = ( b ); a < ( c ); ++ a )

Is there any way to d

4条回答
  •  醉酒成梦
    2021-02-19 01:51

    Thankfully not. There are plenty of horrible things you can do to make unreadable PHP, but that isn't one of them.

    PHP doesn't use a preprocessor by default. Being a dynamic language, there isn't a build step for it to be run as part of. There are third party pre-processors you can use like CCPP, and of course you can write your own, but they are likely to change your workflows considerably.

    An interesting preprocessor for PHP was PiHiPi which tried to add useful features to the language like JSON like array syntax, rather than needing to write array() every time. Unfortunately, the author has pulled it.

提交回复
热议问题