Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

formatting the recurring decimal

Links for php scripts

Moderators: macek, egami, gesf

formatting the recurring decimal

Postby sansoft » Wed May 19, 2004 11:20 pm

Hi all,

i am getting the minutes as 2833333333335. I want just 28 minutes.......

how shud i do it? i know the round function for it.....but i dont know how to use it especially coz the minute is stored in an array ie in

$durmin[minute].i am echoing this to get 2833333333335....

plz help...
sansoft
sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India

Postby gesf » Thu May 20, 2004 2:26 am

Well, maybe there´s a better function for that, but i didn´t found, so...
Code: Select all
<?php

echo substr(2833333333335, 0, 2); // Output: 28

// or...

echo substr($durmin[minute], 0, 2);

?>
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

thank you

Postby sansoft » Thu May 20, 2004 5:17 am

Hi ,
thank u very much.It solved my problem :)
sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron