Home / PHP Tips Generated By ChatGPT / Getting the Type of a Variable in PHP Determine the type of a variable using gettype(). Source Code $var = true; echo gettype($var); // Outputs: boolean