1

Im trying to display a country name from a database with first letter capitalised. For instance, if the country was Brazil, the database has it as 'brazil', and I would like it to be 'Brazil'.

This is the code I have tried:

ucfirst($name) = $country_aa['name'];

And this is the fatal error returned:

Can't use function return value in write context

Thanks

jahsss
  • 13
  • 2

2 Answers2

1

You're not writing to a variable but to a result of a function call. It should be this instead:

$name = ucfirst($country_aa['name']);
Sharky
  • 419
  • 2
  • 8
1

Syntax

ucfirst(string)

$country_name = ucfirst($country_aa['name']);
Athira Das
  • 91
  • 1
  • 2
  • 8