Hi,

i wrote some command for division of numbers by certain number for example 1000000

and

$filesize=$size/1000000;

the result shown some things like this 12.24927

but i need just the first part of this number for example i want to write 12 instead of this 12.24927 . how can i eliminate the second part ?

Try this:

$filesize=(int)($size/1000000);

Use floor() or ceil(), floor will output 12 no matter if it is 12,2 or 12,9, ceil is different, since 12,51 will output 13 instead of 12.

$filesize=floor($size/1000000);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.