我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

(int)$ var与intval($ var)相同吗? [重复]

Possible Duplicates:
Fastest way to convert string to integer in PHP
PHP: Is there any particular difference between intval and (int)?

Is (int)$var same as intval($var) ?

Apparently they both do the same thing.

Is there any situation in which they would return different results?

(int) would seem to be a bit faster than intval, as you don't have the overhead of a function call. intval also allows you to set an optional base to convert to, which might be useful:

int intval ( mixed $var [, int $base = 10 ] )

近期文章

  • 我有阵列问题
  • 关于PHP和闭包[关闭]
  • 在twitter上分享表单输入
  • PHP字符串不包含
  • PHP变量URL新闻页面
  • 使用php curl上传文件
  • 在PhpStorm IDE上使用PHPUnit
  • MySQL将3个表合并为1个
  • PHP Locale获取国家/地区代码
  • php rowcount无效
  • Wordpress侧面菜单小部件
  • 如何按字符串键获取数组?
  • 排序数字php数组
  • 在PHP中使用脱机服务器
  • 从utf 8文件获取utf 8 BOM
  • 获取输入表单的值(PHP)
  • PHP的MySQL语法错误
  • PHP中的Intersect / Diff数组
  • 从curl获取特定数据
  • Java语言,如何实现一个函数里返回2个值,请给出具体代码,答非所问的不采纳

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华