# defender-security/5.5.1/vendor/thecodingmachine/safe/generated/var.php

Defender Security – Malware Scanner, Login Security &amp; Firewall, version 5.5.1. 61 lines.

- Page: https://pluginprobe.com/plugins/defender-security/5.5.1/code/vendor/thecodingmachine/safe/generated/var.php
- Raw: https://pluginprobe.com/plugins/defender-security/5.5.1/raw/vendor/thecodingmachine/safe/generated/var.php
- Modified: 2022-06-13T09:01:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/defender-security/5.5.1/code/vendor/thecodingmachine/safe/generated/var.php#L10-L20`.

```php
<?php

namespace Safe;

use Safe\Exceptions\VarException;

/**
 * Set the type of variable var to
 * type.
 *
 * @param mixed $var The variable being converted.
 * @param string $type Possibles values of type are:
 *
 *
 *
 * "boolean" or "bool"
 *
 *
 *
 *
 * "integer" or "int"
 *
 *
 *
 *
 * "float" or "double"
 *
 *
 *
 *
 * "string"
 *
 *
 *
 *
 * "array"
 *
 *
 *
 *
 * "object"
 *
 *
 *
 *
 * "null"
 *
 *
 *
 * @throws VarException
 *
 */
function settype(&$var, string $type): void
{
    error_clear_last();
    $result = \settype($var, $type);
    if ($result === false) {
        throw VarException::createFromPhpError();
    }
}

```
