<?
$price = "75";
$kdv = $price*18/100;
$kdvdahil = $kdv+$price;
$kdvdahil produces 88.5
?>
我只想将$ kdvdahil分解为两个部分:88和5
我该怎么办?
答案 0 :(得分:2)
然后简单地使用explode()
<?php
# with explode
$number = explode('.',88.5);
echo "integer = $number[0], decimal = $number[1]";
echo PHP_EOL;
# with explode and list
list($int,$dec)=explode('.', 88.5);
echo "integer = $int, decimal = $dec";
?>