我有一个表格,我在我的sql表格中显示数字(例如2.39 ...),就像那个2合1和39其他。我使用的代码是:
var_dump($variable) ;
看起来像是:
但是我很难将值更新回sql表中的数字。
还有其他解决方案吗?
答案 0 :(得分:1)
您可以使用explode
在点后分割字符串。
$number = explode('.',2.39);
echo $number[0]; // ouptuts 2
echo $number[1]; // ouptuts 39
答案 1 :(得分:0)
您可以使用explode在点后分割字符串。
$split = explode('.', $row['S1']);
// integer: $split[0]; decimals: $split[1];