How to get the real type of a value inside string?

Posted by CuSS on Stack Overflow See other posts from Stack Overflow or by CuSS
Published on 2010-04-22T12:19:00Z Indexed on 2010/04/22 12:23 UTC
Read the original article Hit count: 317

Filed under:
|
|

I was searching here on StackOverflow about converting string to the real value and i didn't found. I need a function like "gettype" that does something like the result above, but i can't do it all :s

gettypefromstring("1.234"); //returns (doble)1,234;
gettypefromstring("1234"); //returns (int)1234;
gettypefromstring("a"); //returns (char)a;
gettypefromstring("true"); //returns (bool)true;
gettypefromstring("khtdf"); //returns (string)"khtdf";

Thanks to all :)

© Stack Overflow or respective owner

Related posts about php

Related posts about variables