Dev Loots Dev Loots - 5 months ago 144
PHP Question

Fatal error: Cannot declare class Locale, because the name is already in use in

I have migrated my server to PHP 7.0.8 and I have the following error :


Fatal error: Cannot declare class Locale, because the name is already in use


I have a class named Locale without namespace but that works on PHP5.

How I can pass this error ?

Answer

The Locale class comes from the intl extension. Perhaps you didn't have it installed on PHP 5?

Use namespaces to avoid class name conflicts. They've been in PHP for years now.

Comments