Is it possible to switch in PHP based on version?

前端 未结 4 1222
一生所求
一生所求 2021-01-25 17:48

I have a function in one of my PHP scripts that relies on version 5.3 to run.

I thought that if it was in a function that didn\'t happen to get called when run on a serv

4条回答
  •  余生分开走
    2021-01-25 18:20

    You might look at implementing PHP 5.3+ functions if they don't exist.

    if (!function_exists('array_replace')) {
        function array_replace(....) {
            // logic here
        }
    }
    

    If you have to detect the version, you can use PHP_VERSION.

提交回复
热议问题