---
title: "Var"
description: "Static variable related functions."
canonical_url: "https://www.zeyos.com/zymba/ref/var"
markdown_url: "https://www.zeyos.com/ai/guide/zymba/ref/var.md"
section: "zymba-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/zymbaref.json"
source_sha256: "05a361c6ddc32e74f4a6dc16fd06f218210ff1b7ce57f26ca1994bfffc407915"
---

# Var

## Var

```
object @Var() {
	clone(mixed $value): mixed {}
	cloneDeep(mixed $value): mixed {}
	compare(mixed $value1, mixed $value2): int {}
	count(mixed $value): int {}
	countGlobalVariables(): int {}
	exists(mixed $value): bool {}
	fromJSON(string $string): mixed {}
	fromSerializedPHP(string $string): mixed {}
	isBool(mixed $value): bool {}
	isComplex(mixed $value): bool {}
	isEmpty(mixed $value): bool {}
	isFloat(mixed $value): bool {}
	isFunction(mixed $value): bool {}
	isInt(mixed $value): bool {}
	isNull(mixed $value): bool {}
	isNumber(mixed $value): bool {}
	isNumeric(mixed $value): bool {}
	isObject(mixed $value): bool {}
	isScalar(mixed $value): bool {}
	isString(mixed $value): bool {}
	isValidJSON(string $string): bool {}
	listGlobalVariableNames(): object {}
	listGlobalVariables(): object {}
	pack(string $format, ...$arguments): string {}
	toJSON(mixed $value): string {}
	toPrettyJSON(mixed $value): string {}
	toSerializedPHP(mixed $value): string {}
	toSource(mixed $value): string {}
	typeOf(mixed $value): string {}
	unpack(string $format, string $string): object {}
}
```

**Static variable related functions.**

## Functions


### `@Var.clone()`


Clones the value by creating a shallow copy.

```code
@Var.clone(mixed $value): mixed
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `mixed` |  |




### `@Var.cloneDeep()`


Clones the value by creating a deep copy.

```code
@Var.cloneDeep(mixed $value): mixed
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `mixed` |  |




### `@Var.compare()`


Compares two values.

```code
@Var.compare(mixed $value1, mixed $value2): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value1 | `mixed`  |  | null |
| value2 | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `int` | +1 |
| `int` | -1 |
| `int` | 0 |




### `@Var.count()`


Counts the total number of intrinsic constituents of a value.

```code
@Var.count(mixed $value): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@Var.countGlobalVariables()`


Counts the total number of global variables.

```code
@Var.countGlobalVariables(): int
```

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@Var.exists()`


Determines whether a value exists, meaning is not null.

```code
@Var.exists(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.fromJSON()`


Returns the value corresponding to a JavaScript Object Notation (JSON) representation according to RFC 4627.

```code
@Var.fromJSON(string $string): mixed
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `mixed` |  |




### `@Var.fromSerializedPHP()`


Returns the value corresponding to a serialized PHP representation.

```code
@Var.fromSerializedPHP(string $string): mixed
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `mixed` |  |




### `@Var.isBool()`


Determines whether a value is of type "bool", meaning either true or false.

```code
@Var.isBool(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isComplex()`


Determines whether a value is of a complex type.

```code
@Var.isComplex(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isEmpty()`


Determines whether a value is empty, meaning either null, an empty string or an empty object.

```code
@Var.isEmpty(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isFloat()`


Determines whether a value is of type "float".

```code
@Var.isFloat(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isFunction()`


Determines whether a value is of type "function".

```code
@Var.isFunction(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isInt()`


Determines whether a value is of type "int".

```code
@Var.isInt(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isNull()`


Determines whether a value is null.

```code
@Var.isNull(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isNumber()`


Determines whether a value is a number, meaning of type "int" or "float".

```code
@Var.isNumber(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isNumeric()`


Determines whether a value is numeric, meaning a number or the string representation thereof.

```code
@Var.isNumeric(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isObject()`


Determines whether a value is of type "object".

```code
@Var.isObject(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isScalar()`


Determines whether a value is of a scalar type, meaning all primitive non-composite types.

```code
@Var.isScalar(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isString()`


Determines whether a value is of type "string".

```code
@Var.isString(mixed $value): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.isValidJSON()`


Determines whether a string represents a valid JavaScript Object Notation (JSON) representation according to RFC 4627.

```code
@Var.isValidJSON(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@Var.listGlobalVariableNames()`


Lists all variable names of global scope.

```code
@Var.listGlobalVariableNames(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name, ...] |




### `@Var.listGlobalVariables()`


Lists all variables of global scope.

```code
@Var.listGlobalVariables(): object
```

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |




### `@Var.pack()`


Packs variadic arguments into binary data according to a specific Perl/PHP-compatible format.

```code
@Var.pack(string $format, variadic $arguments): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| format | `string`  |  | "" |
| arguments | `variadic`  |  | ... |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.toJSON()`


Returns the JavaScript Object Notation (JSON) representation of a value according to RFC 4627.

```code
@Var.toJSON(mixed $value): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.toPrettyJSON()`


Returns the JavaScript Object Notation (JSON) representation of a value according to RFC 4627 in human-readable form.

```code
@Var.toPrettyJSON(mixed $value): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.toSerializedPHP()`


Returns the serialized PHP representation of a value.

```code
@Var.toSerializedPHP(mixed $value): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.toSource()`


Returns the Zymba source-code literal representation of a value.

```code
@Var.toSource(mixed $value): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.typeOf()`


Returns the type of a value.

```code
@Var.typeOf(mixed $value): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| value | `mixed`  |  | null |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@Var.unpack()`


Unpacks values from binary data according to a specific Perl/PHP-compatible format.

```code
@Var.unpack(string $format, string $string): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| format | `string`  |  | "" |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [value, ...] |
