Received: from hapcibeno.freestart.hu (hapcibeno.freestart.hu [213.197.64.8]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAGE7Hm29709 for ; Fri, 16 Nov 2001 09:07:18 -0500 (EST) (envelope-from pgerzson@freestart.hu) Received: from erinyes.freestart.hu ([213.197.64.251] helo=jaguar) by freestart.hu with smtp (Freestart relay 2 (FS-Lin)) id 164jyk-0003Pn-00; Fri, 16 Nov 2001 15:28:27 +0100 Message-ID: <023601c16ea8$4c4c1460$01fdfea9@jaguar> From: "Papp Gyozo" To: "Wesley Leonard" , Cc: References: <00cf01c0b307$02ac4080$543987cf@corp.peoplesoft.com> <09fd01c0ce65$ccd14760$e875f718@imago> <3AE843D0.AF0C8010@pacdemon.org> Subject: Re: Re: data type casting to numbers with intval() or doubleval() Date: Fri, 16 Nov 2001 08:15:06 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Scanner: exiscan by Freestart Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by postgresql.org id fAGEAmL29781 X-Archive-Number: 200111/114 X-Sequence-Number: 755 > I think a regex would be most appropriate here: > > > $my_string = "mmm444"; > > $my_integer = intval(eregi_replace("[a-z]", "", $my_string)); > > print $my_integer; > > ?> > > This removes all letters and takes the int value. In perl you can remove > everything that's NOT a digit but I didn't figure that out in PHP yet... this > should do for now. you're thinking of something like: $my_integer = intval(preg_replace('!\D+!', '', $my_string)); aren't you? PCRE regular expression finctions are PERL compatible reg. functions using PCRE library.