Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<variant_andvariant_cat>
^COM FunctionsLast updated: Mon, 26 Oct 2026

variant_cast

(PHP 5, PHP 7, PHP 8)

variant_cast — Convert a variant into a new variant object of another type

Description

function variant_cast(variant $variant, int $type): variant

This function makes a copy of variant and then performs a variant cast operation to force the copy to have the type given by type.

This function wraps VariantChangeType() in the COM library; consult MSDN for more information.

Parameters

variant

The variant.

type

type should be one of the VT_* constants.

Return Values

Returns a variant of given type.

See Also


<variant_andvariant_cat>
^COM FunctionsLast updated: Mon, 26 Oct 2026