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

后端 未结 9 1327
鱼传尺愫
鱼传尺愫 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:15

    In PHP, (int) will cast the value following it to an int.

    Example:

    php > var_dump((int) "5");
    int(5)
    

    I believe the syntax was borrowed from C.

提交回复
热议问题