$price = $product->fiyat1 / $currency_values[0];
我试图做这个值是
$product->fiyat1 = 50,75
$currency_values[0] = 1.0000
它将此值设为50.0000,但我需要这个50.7500
答案 0 :(得分:0)
浮点数(也称为“浮点数”,“双打”或“真实数字” 数字“)可以使用以下任何语法指定:
<?php $a = 1.234; $b = 1.2e3; $c = 7E-10; ?>
答案 1 :(得分:0)
<?php
$product_fiyat1 = '50,75';
$currency_values[0] = 1.0000;
$number1 = floatval(str_replace(',', '.', str_replace('.', '', $product_fiyat1)));
$number2 = floatval($currency_values[0]);
$price = $number1 / $number2;
echo $price;
?>