<?php namespace Faker { class Factory { public static function create(string $lang) { return new class() { public $name = 'someName'; }; } } } namespace { function index() { $faker = Faker\Factory::create('fr_FR'); $ideas = []; $ideas = []; for($i = rand(10, 50); $i > 0; $i--) { $ideas[] = new class($ideas, $faker) { private $id; private $author; function __construct($ideas, $faker) { $this->id = count($ideas) + 1; $this->author = $faker->name; } }; } var_dump($ideas); echo PHP_EOL; echo PHP_EOL; echo PHP_EOL; echo PHP_EOL; } index(); }
You have javascript disabled. You will not be able to edit any code.