Re: convert string to number

From: Date: Fri, 16 May 2003 16:08:36 +0000
Subject: Re: convert string to number
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147914@lists.php.net to get a copy of this message
I'm not shure, but if you know that the string is "[number] stars" you could use $newstring=ereg_replace(" stars", "", $oldstring); this replaces the " stars" in $oldstring with nothing ("") and creates a new string $newstring, for further details look into the onlinehelp of php... but there is think teher is a better resolution for your problem (I do php for about 3 month now, so i don't know all commands) Archimedes (ähm... and sorry for the bad english, i used to speak german ;) ) "Diana Castillo" <diana@interhotel.com> wrote in message news:20030516152527.29560.qmail@pb1.pair.com... > is there a function to only find the numeric part of a string, e.g. > it would convert "4 stars" to 4 > and what about "four stars" to 4? > thanks, > Diana > >

« previous php.general (#147914) next »