15,076
edits
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Print type of the variable | Print type of the variable | ||
* PHP gettype() | * PHP gettype()<ref>[http://php.net/manual/en/function.gettype.php PHP: gettype - Manual]</ref>: | ||
<pre> | |||
# define the variable | |||
$var = 3.14159; | |||
# print type of the variable | |||
echo "type of variable: " . gettype($var); | |||
</pre> | |||
* Python type():<ref>[https://docs.python.org/3.6/library/functions.html?highlight=type#type type]</ref><ref>[https://waoewaoe.wordpress.com/2009/05/18/type-cast-variable-to-string-in-python/ Type cast variable to String in python | Ploy's Blog | A Blog About Techinical Stuff]</ref> or {{kbd | key=<nowiki>print(type(var))</nowiki>}} | * Python type():<ref>[https://docs.python.org/3.6/library/functions.html?highlight=type#type type]</ref><ref>[https://waoewaoe.wordpress.com/2009/05/18/type-cast-variable-to-string-in-python/ Type cast variable to String in python | Ploy's Blog | A Blog About Techinical Stuff]</ref> or {{kbd | key=<nowiki>print(type(var))</nowiki>}} | ||
<pre> | <pre> | ||
# define the variable | |||
var = 3.14159 | |||
# print type of the variable | |||
type(var) # return <class 'type'> | type(var) # return <class 'type'> | ||
print(type(var)) | print(type(var)) | ||
| Line 10: | Line 21: | ||
* Javascript typeof()<ref>[https://www.w3resource.com/javascript/operators/typeof.php JavaScript : typeof operator - w3resource]</ref> | * Javascript typeof()<ref>[https://www.w3resource.com/javascript/operators/typeof.php JavaScript : typeof operator - w3resource]</ref> | ||
<pre> | <pre> | ||
typeof | # define the variable | ||
console.log("type of variable:: " + typeof | var a = 3.14159; | ||
# print type of the variable | |||
typeof a; | |||
console.log("type of variable:: " + typeof a); | |||
</pre> | </pre> | ||
* R: [https://stat.ethz.ch/R-manual/R-devel/library/base/html/typeof.html typeof()] | * R: [https://stat.ethz.ch/R-manual/R-devel/library/base/html/typeof.html typeof()] | ||