RE: [PHP] a rather easy question
| From: | o dot cook at etoncollege dot org dot uk | Date: | Sat, 28 Oct 2000 11:31:09 +0000 |
| Subject: | RE: [PHP] a rather easy question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22435@lists.php.net to get a copy of this message | ||
Try casting the value to an integer. e.g.:
$width = (int) $number/$max*100;
Regards,
Ollie
> -----Original Message-----
> From: d.h.g.theloosen [mailto:d.h.g.theloosen@chello.nl]
> Sent: 28 October 2000 10:41
> To: php-general@lists.php.net
> Subject: [PHP] a rather easy question
>
>
> Hello,
>
> This is a rather easy question I think, but I've just started
> with Php, and in
> the book I use there's nothing concerning my problem.
>
> I have two numbers:
> the number of records in the table $max
> and the count of the ip field $number
> to give a percentage of how often the ip number exists in the
> table, I should
> say $number/$max*100;
>
> In the book I've reaad that when deviding entire numbers, the
> result is an
> entire number.
> But I get a result with a lot of number behind the comma.
>
> I don't know how to get a result without numbers behind the
> comma, I need the
> number to create a bar (the number is the width of a picture).
>
> Greetings Emiel Theloosen
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>