0

How can I make the variable readable inside the path?

$country = 'en_PH';
$faker->addProvider(new Faker\Provider\$country\Address($faker));

solved thank you so much

solution:

$path = "Faker\\Provider\\$country\\Address";
$faker->addProvider(new $path($faker));
  • Use string concatenation like ```$path = "Faker\\Provider\\$country\\Address";``` and later call it like ```$faker->addProvider(new $path($faker));``` – Top-Master Oct 16 '19 at 10:56
  • Thank you so much it solved my problem :) – jadpefa Qwasvi Oct 16 '19 at 11:00
  • @jadpefaQwasvi In case you found a solution, it would be fine to post that as an answer and accept your own answer, instead of editing the question. – feeela Oct 16 '19 at 13:02

0 Answers0