How to create loop templates in php

后端 未结 4 1490
清酒与你
清酒与你 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:26

    CCPP seems to be closest thing available:

    #define macroFunction(op1,op2,op3) ((int)op1/((int)op2+(int)op3))
    #define hash_hash # ## #
    #define showCExamples 1
    
    #if showCExamples
    //Reference: http://en.wikipedia.org/wiki/C_preprocessor#Token_concatenation
    #define MYCASE(item,id) \
    case id: \
      item##_##id = id;\
    break
    
    switch(x) {
        MYCASE(widget,23);
    }
    

提交回复
热议问题