Dynamic Comparison Operators in PHP

后端 未结 11 695
挽巷
挽巷 2020-12-03 11:24

Is it possible, in any way, to pass comparison operators as variables to a function? I am looking at producing some convenience functions, for example (and I know this won\'

11条回答
  •  离开以前
    2020-12-03 12:02

    As far as I know it is not possible and since there is no reference about callback on operators in PHP documentation, http://www.php.net/manual/en/language.operators.php

    instead of using eval, I would redefine each operators in global functions and use php callbacks How do I implement a callback in PHP?

提交回复
热议问题