Skip to content

Faker Address Country Abbreviation

The faker::address_country_abr function generates a random country abbreviation, such as “US” or “CA”.

Syntax

faker::address_country_abr()

Parameters

  • None: This function does not require any parameters.

Returns

  • String: A random country abbreviation.

Example

Try it out below!
faker::address_country_abr()

This function is useful for generating location-based test data or simulating user input requiring country codes.