pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: imago <imago@imago3d.com>
To: pgsql-php@postgresql.org
Cc: Wesley Leonard <marshall@pacdemon.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> (raw)
References: <Pine.OSF.3.96.1010322172104.28810A-100000@student.cs.ucc.ie>
	<00cf01c0b307$02ac4080$543987cf@corp.peoplesoft.com>

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




view thread (3+ messages)  latest in thread

Message-ID: <09fd01c0ce65$ccd14760$e875f718@imago>
Permalink:  ../09fd01c0ce65$ccd14760$e875f718@imago/
Also on:    postgresql.org/message-id/09fd01c0ce65$ccd14760$e875f718@imago

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: imago@imago3d.com, marshall@pacdemon.org
  Subject: Re: data type casting to numbers with intval() or doubleval()
  In-Reply-To: <09fd01c0ce65$ccd14760$e875f718@imago>
  References: <Pine.OSF.3.96.1010322172104.28810A-100000@student.cs.ucc.ie> <00cf01c0b307$02ac4080$543987cf@corp.peoplesoft.com> <09fd01c0ce65$ccd14760$e875f718@imago>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox