<?php declare(strict_types=1); class Foo { public $bool; public $int; public function __construct( bool $bool, int $int ) { $this->bool = $bool; $this->int = $int; } } $args = ['bar', '10']; $reflection = new \ReflectionClass(Foo::class); $constructor = $reflection->getConstructor(); $instance = $reflection->newInstance(...$args); var_dump($instance);
You have javascript disabled. You will not be able to edit any code.