[Linux-programlama] Re: is_int fonk

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: M.ATIF CEYLAN (atifceylan@gmail.com)
Date: Mon 13 Feb 2006 - 13:39:59 EET


13.02.2006 tarihinde ahmet demir <turkosx@gmail.com> yazmış:
> mrb,
> elimde sadelestirdigim miik bir toplama islemi var bu toplama islemini
> sonucu normalde is_int olarak cikamsı gerekirken is_float dedigim zaman
> cikiyor yani $toplam degeri float degermis gibi algiliyor bunun sebebi
> nedir
>
> $sayi1="3.5";
> $sayi2="2.5";
>
>
> $toplam=($sayi1+$sayi2);
> if (is_int($toplam))
> {
> echo $toplam;
> }
>
$sayi1="3.5";
$sayi2="2.5";

$toplam=($sayi1+$sayi2);
$bol = explode($toplam,".");
if ($bol[1] > 0) //noktadan sonrasını al sıfırdan buyukmu kontrol et
floatdır orneğin (6.10)

ayrıca tip değiştirmek içinde settype($toplam,integer) kullanabilirsiniz.
iyi çalışmalar....

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.