Get datatype URI for a PHP value.
This static function is intended for internal use. Given a PHP value, it will return an XSD datatype URI for that value, for example: http://www.w3.org/2001/XMLSchema#integer
string A URI for the datatype of $value.
public static function getDatatypeForValue($value) {
if (is_float($value)) {
return 'http://www.w3.org/2001/XMLSchema#decimal';
}
elseif (is_int($value)) {
return 'http://www.w3.org/2001/XMLSchema#integer';
}
elseif (is_bool($value)) {
return 'http://www.w3.org/2001/XMLSchema#boolean';
}
elseif (is_object($value) and $value instanceof DateTime) {
return 'http://www.w3.org/2001/XMLSchema#dateTime';
}
else {
return null;
}
}