How to programmatically check if running on HHVM?

前端 未结 2 666
孤街浪徒
孤街浪徒 2020-12-30 00:11

I need to run a given package on both HHVM runtime and traditional PHP runtime. My question: is there a way to check programmatical

2条回答
  •  遥遥无期
    2020-12-30 00:26

    Some older versions of HHVM don't have HHVM_VERSION defined. They all output "HipHop" in phpinfo().

    function is_hhvm(){
      ob_start();
      phpinfo();
      $info=ob_get_contents();
      ob_end_clean();
      return ($info=='HipHop');
    }
    

提交回复
热议问题