That works more like I wanted, thanks!
The way I have it now, it's always returned as a string in addition to 'boolean' and 'integer'. Is there a way I could narrow it down so that when I put in
$SMTP_PORT = "25";
or
$SMTP_PORT = 25;
it would tell me that "25" is a string and 25 is an integer?
This may answer my own question:
I'd have to use some function to check for the existence of =, and look at everything following the first occurence of that. Finding that, check for the existence of '', "" or not.
As for arrays, I suppose for that I could check for the existence of the word 'array' in a regexp.
<?php
$string = $_POST['expression'];
switch ($i) {
case "submit":
if ( preg_match('/^\d+$/',$string) ) {
/// assume we have an int
echo "this is an integer";
}
/// if it is only the string TRUE or FALSE
if ( preg_match('/^(true|false)$/',$string) ) {
/// assume we have a bool
echo "this is boolean";
}
if (is_string($string)) {
echo "This is a string.";
}
if (is_array($string)) {
echo "This is an array.";
}
echo '<form action="'.$PHP_SELF.'?i=submit" method="POST" enctype="application/x-www-form-urlencoded"><input type="text" name="expression" value="'.$expression.'"/><input type="submit" value="Submit" /></form>';
echo '<BR>';
echo '';
break;
default:
echo '<form action="'.$PHP_SELF.'?i=submit" method="POST" enctype="application/x-www-form-urlencoded"><input type="text" name="expression" value="'.$expression.'"/><input type="submit" value="Submit" /></form>';
}
?>