for a $_POST array how do i get the data type for each element evan though its always string? heres what I mean:
$a = array("2", "string", "42");
element 0 is int, 1 is string and 2 is int. How can i code this?
you will have to use something like [man]is_int[/man] or [man]is_float[/man] to figure that since after a form post all variables are converted to strings. however since php doesnt enfore strict type checking, you could still do arithmetic with the numeric string, as it will be cast to a numeric type.
you may also want to look at [man]is_numeric[/man]
Just as a note, is_int is a strict check. "1" will return false.
you may also want to look at ctype_digit()
thanks, I figured a way round the problem.
Originally posted by PurpleMonkey thanks, I figured a way round the problem.
Care to share with the community?