Hi,

This is my excel sheet
B
1. marks
2. 50.65

my php code is:

$marks  = round($Worksheet->Cells->Item($i,2),0);
           echo $marks;

output is:
50 (wrong output)

I need the output: 51 . How to check this using php coding? Thanks in advance

Try this

$mark=$Worksheet->Cells->Item($i,2);
    $marks = round($mark);
    echo $marks;

What you told ? I tried this before itself.My value is not getting it round off.

commented: be polite, the one asking for help should not attack any offers of help -3

"Karthik_pranas" is right it's working fine you need to just round() value.. I trying this my self..

Hi,
I am getting values from my excel (ie) 50.65. calling in the php ...round is not working.

at least it means your host is using php5.3 (>=5.27 anyway) the handling of round() was altered to comply with some standard
http://php.net/manual/en/function.round.php

echo round($Worksheet->Cells->Item($i,2),0,PHP_ROUND_HALF_UP);

'standards' is not intuituve, behaves WRONG

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.