1.2.394. Dynamic New

Dynamic instantiation of classes. It happens when the name of the class is an executable expression, and, as such, only known at execution time.

<?php

    $classname = foo();
    $object = new $classname();

    $object = new (foo());
?>

1.2.394.1. Specs

Short name

Classes/DynamicNew

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

new, parenthesis, dynamic-call

Available in

Entreprise Edition, Community Edition, Exakat Cloud