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.
>
>
>
> ""phpman"" <[EMAIL PROTECTED]> wrote in message
> news:99132e$ol8$[EMAIL PROTECTED]...
> > hello all,
> >
> >  let's say i have this:
> > $a="varone=hello world|vartwo=2.44|varthree=100|";
> >
> > now i do this:
> >
> > $b=explode('|',$a);
> > $z=count($b);
> > for ($x=0;$x<$z;$x++) {
> >     $tmp=explode('=',$b[$x]);
> > ....
> >
> > and i want to find out if  $tmp[1] is a string or an integer (that's
> really
> > all I need to determine so i can put
> > together an SQL statement that puts single quotes around strings and
none
> > around integers). Obviously
> > i won't know at design time all of the variables and their values. Thank
> > you.
> >
> > -dave
> >
> >
> >
> > --
> > PHP General 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]
> >
>
>
>
> --
> PHP General 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]



-- 
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]

Reply via email to