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

PHP:表示数字的“多字节”字符串的数学计算

In PHP, I have a string variable that contains a number. The string is a multibyte string and with UTF-8 encoding.

When I echo the variable($str), it prints 1392. But the problem is that calculations on this variable fails. Consider the output of the following lines:

echo $str; // Prints 1392

echo $str + 0; // Prints 0 (it should print 1392)

echo $str + 1; // Prints 1 (it should print 1393)

echo bin2hex($str); // Prints: dbb1dbb3dbb9dbb2

近期文章

  • 剪切视频缩略图在PHP中
  • springboot全局时间类型转换
  • centos7+python3.7安装mod_wsgi时发生错误
  • Android Studio的项目运行时报错:Error configuring CMake server
  • 用户关于cURL请求的数据
  • 修剪一个段落
  • PHP中的ISO日期时间
  • PHPMailer没有回复
  • 如何在jQuery上移动鼠标时放大和缩小屏幕的一部分?
  • PHP中的打印机功能无法打印中文字符(UTF-8)
  • 为什么Magento会在简单地添加一个项目后自动考虑放弃购物车?
  • Laravel 4:唯一(数据库)未验证
  • 控制器查看传递数组
  • 解析HTML用户输入
  • 如何更改GET方法URL以清除PHP中的URL?
  • PHP多维数组,仅通过1个foreach循环获取指定数据
  • NetBeans:Git:切换到不同的分支,提交丢失
  • 如何使用SMOF选项框架在wordpress上更改/制作动态Wordpress布局
  • 读入特定目录中的所有文件会在html列表中显示文件名
  • 将表单扩展名应用于某些Symfony表单,而不是其他表单

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华