gettype code example
Example 1: find type of variable c#
string StringType
Type TheType = StringType.GetType();
Console.WriteLine(TheType.Name)
if(YourVar is YourType)
Console.WriteLine("Is your type you are testing for")
Example 2: get type of var js
function doSomething(x) {
if(typeof(x) === 'string') {
alert('x is a string')
} else if(typeof(x) === 'number') {
alert('x is a number')
}
}
Example 3: getttype php
gettype ( mixed $var ) : string
gettype ("SALUT") => string
gettype (2) => integer
...etc ...
"bool"
"integer"
"double"
"array"
"object"
"resource"
"NULL"
"unknown type"
Example 4: javascript find type of variable
> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"
if(typeof bar === 'number') {
}
Example 5: how to find the type of a object c#
use the "is" keyword