What does (int) $_GET['page'] mean in PHP?

后端 未结 9 1357
鱼传尺愫
鱼传尺愫 2021-02-18 23:02

I tried looking up (int) but could only find documentation for the function int() in the PHP manual.

Could someone explain to me what the above

9条回答
  •  臣服心动
    2021-02-18 23:17

    Simple example will make you understand:

    var_dump((int)8);
    var_dump((int)"8");
    var_dump((int)"6a6");
    
    var_dump((int)"a6");
    
    var_dump((int)8.9);
    var_dump((int)"8.9");
    var_dump((int)"6.4a6");
    

    Result:

    int(8)
    int(8)
    int(6)
    
    int(0)
    
    int(8)
    int(8)
    int(6)
    

提交回复
热议问题