Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

data type casting to numbers with intval() or doubleval()


  • From: "imago" <imago(at)imago3d(dot)com>
  • To: <pgsql-php(at)postgresql(dot)org>
  • Cc: "Wesley Leonard" <marshall(at)pacdemon(dot)org>
  • Subject: data type casting to numbers with intval() or doubleval()
  • Date: Thu, 26 Apr 2001 11:30:04 -0400
  • Message-id: <09fd01c0ce65$ccd14760$e875f718@imago> <text/plain>

I am having a problem with the intval() function

I am using it to take string data and extract the number it would
represent if only numeric.

$my_integer = intval($my_string)

when the sting is numbers followed by letters -
$my_string = 4444mmm
$my_integer = 4444
it works as expected

but when letters are followed by numbers
$my_string = mmm4444
$my_integer = 0

Same problem with doubleval()

What am I missing????  how do I drop the non-numeric parts of a
string?

imago




Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group