在PHP中将字符串转换为整数

问题描述 投票:1回答:6

我一直在尝试在PHP中将字符串转换为int来对其进行操作,但PHP一直将其解释为0。

var_dump ($Pux); // output: string (6) "89"

我尝试过几种方式

(int) $Pux,
intval($Pux)
settype($Pux, "integer")

但他们都给我0而不是89。

该怎么做?

php string casting int
6个回答
© www.soinside.com 2019 - 2024. All rights reserved.