点后如何爆炸价格

时间:2018-11-17 14:52:23

标签: php

<?
$price = "75";
$kdv = $price*18/100; 
$kdvdahil = $kdv+$price; 

$kdvdahil produces 88.5

?>

我只想将$ kdvdahil分解为两个部分:88和5

我该怎么办?

1 个答案:

答案 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";
?>

演示: https://3v4l.org/HhvDD