<?php /** * @author ciid */ class Variadic { public array $names = []; public function __construct( string ...$names, // ...[string $name => mixed $value], ) { $this->names = $names; } } $var = new Variadic('wan', 'chew', 'tree'); var_dump($var); $json = '{"names":["wan", "chew", "tree"]}'; $obj = json_decode($json); var_dump($obj);
You have javascript disabled. You will not be able to edit any code.