formatting the recurring decimal

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
sansoft
New php-forum User
New php-forum User
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India
Contact:

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

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

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);

?>
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

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

Thu May 20, 2004 5:17 am

Hi ,
thank u very much.It solved my problem :)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest