1.2.1424. Variable Variables

A variable variable takes the value of a variable and treats that as the name of a variable.

PHP has the ability to dynamically use a variable.

They are also called ‘dynamic variable’.

<?php

// Normal variable
$a = 'b';
$b = 'c';

// Variable variable
$d = $$b;

// Variable variable in string
$d = "$\{$b\}";

?>

See also Variable variables.

1.2.1424.1. Specs

Short name

Variables/VariableVariables

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

variable-variable, variable

Available in

Entreprise Edition, Community Edition, Exakat Cloud