You could use ereg/preg to determine whether it: a) consists of nothing but digits from beginning to end, example: ^[0-9]+$ b) consists of nothing but digits separated by a single decimal, example: ^[0-9]+[.][0-9]+$ c) doesn't match the first two conditions, and therefore assume it is a string. In article <9938lh$e5k$[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("phpman") wrote: > i can't though, the variable and its value comes out of a string .. like > this.. > > $var_string = > "var1=this_is_a_value|var2=4.5|var3=another_value|var4=3.1415"; > > then i extract the pairs of vars and vals, then I need to determine if val > is string or integer. > > > ----- Original Message ----- > From: "Michael Geier" <[EMAIL PROTECTED]> > To: "phpman" <[EMAIL PROTECTED]> > Sent: Sunday, March 18, 2001 2:37 PM > Subject: RE: [PHP] how do i get a variable type? - not that simple > > > > anything wrapped in quotes is a string... > > > > try: > > > > $a=3; > > echo(gettype($a)); > > > > -----Original Message----- > > From: phpman [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, March 18, 2001 12:44 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] how do i get a variable type? - not that simple > > > > > > No guys. that doesn't work. Take this code for example... > > > > $a="3"; > > echo(gettype($a)); > > > > this returns string > > i need to find it as an integer or real or float for the sql. which by the > > way is MySQL. > > > > thank you for responding, but I already know that gettype and all the > other > > is_* don't work for this. -- CC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]