Skip to content

Conversation

@thekid
Copy link
Member

@thekid thekid commented Feb 15, 2020

See php/php-src#5061, merged Feb. 11th, 2020 and targeted for PHP 8.0

function factory() { return Date::class; }

$date= new (factory())();  // instance of Date class

Previously, a temporary variable would have been necessary:

function factory() { return Date::class; }

$class= factory();
$date= new $class();  // instance of Date class

See php/php-src/pull#5061
@thekid thekid merged commit 477dccd into master Feb 15, 2020
@thekid thekid deleted the feature/new_expr branch February 15, 2020 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants