← PHP

[PHP] - get_called_class()

Lida 1598 vezes

Offline

HibridO 
Membro
Mensagens 8 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 First Post Karma Eighth year Anniversary Seventh year Anniversary

Boas,

Acabei de fazer update para o PHP 5.3.0 e não estou a conseguir usar a função get_called_class().

Alguem me pode dar uma ajuda?

Código: [Seleccione]
class DatabaseObject {
protected static $table_name = get_called_class();

Citar
Parse error: parse error, expecting `','' or `';'' in C:\wamp\www\site\includes\databaseObject.php on line 5
Offline

HibridO 
Membro
Mensagens 8 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 First Post Karma Eighth year Anniversary Seventh year Anniversary

Após matar a cabeça durante algum tempo, consegui perceber.

A função get_called_class() não pode ser chamada fora de uma função.

Fica aqui para quem de futuro tiver o mm problema.

Abraço