Is there something that's larger than any numbers in PHP?

前端 未结 9 1533
谎友^
谎友^ 2021-01-19 03:12

I need to simulate a ∞ in PHP.

So that min(∞,$number) is always $number.

9条回答
  •  被撕碎了的回忆
    2021-01-19 04:00

    If your only concern is comparison function then yes, you can use array(), it will be always larger then any number

    like

    echo min(array(), 9999999999999999);
    

    or

    if (array() > 9999999999999999) {
      echo 'array won';
    } else {
      echo 'number won';
    }
    

提交回复
热议问题