Jump to content


Photo

Numbers bloody numbers! :-)


  • Please log in to reply
3 replies to this topic

#1 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 04 October 2006 - 03:42 AM

Hey Hey

il just dive right in..

$number = "00000000987" // $number could be anything but in 00000000000 format so it cud be 00000121214  etc.

When i do this

echo $number;

i want it to trim it to just "987" ... so knock off the starting 0's . Iv been playing around but i dont seem to be able to get it right. any help would be great! Its sending me wappy lol.
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#2 logu

logu
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 04 October 2006 - 04:02 AM



You can user either

echo intval($number);

or

echo (int) $number;

try it


#3 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 04 October 2006 - 04:05 AM

wooooooooooo

jesus! thanks so much logu.
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#4 tippy_102

tippy_102
  • Members
  • PipPipPip
  • Advanced Member
  • 446 posts

Posted 04 October 2006 - 04:07 AM

$number = ltrim( $number, "0" );
Fur is more actively protested than leather 'cause its easier to harrass rich women than biker gangs.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users