9951 explained code solutions for 126 technologies


php-fakerHow can I generate a business name using PHP Faker?


Using PHP Faker you can easily generate business names with a few lines of code.

Here is an example code block:

<?php
$faker = Faker\Factory::create();

echo $faker->company;

This code will generate an output like this:

Smith-Mcguire

The code consists of three parts:

  1. $faker = Faker\Factory::create(); - this creates a Faker instance.
  2. echo $faker->company; - this prints out a random business name.
  3. The closing ?> tag - this is the closing tag for the PHP code.

For more information on using PHP Faker, you can check out the official documentation here.

Edit this code on GitHub