duanli6834 2017-05-17 09:37
浏览 70

当我在PHP中显示变量时,为什么零和字母缺失?

I'm new to PHP and I got somebody else's code to work on.

There are multiple variables including $CARD.

But unlike other variables $CARD cannot display a character.

For example, when I input a value like 'passw0rd', all the other variables outputs 'passw0rd'. But the $CARD variable outputs a '0'.

And also, when I take an input like '0123', all the other variables outputs the same '0123'. But only the $CARD variable drops the 0 and outputs '123'.

Is there any PHP elements that I should be suspecting/?

  • 写回答

1条回答 默认 最新

  • duanchi8112 2017-05-17 09:52
    关注

    If you see some thing like this in the code. that $CARD variable is cast to int.

    $num = "3.14";
    $CARD = (int)$num;
    

    You can convert it to string as follows.

    $var2 = (string)$CARD;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?