Php 상수 표현식에는 잘못된 연산이 포함되어 있습니다

코드 예제

0
0

php 상수 표현식에는 잘못된 연산이 포함되어 있습니다

Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\study\insertdata.php on line 5
0
0

php 상수 표현식에는 잘못된 연산이 포함되어 있습니다


From the official Php documentation :

Like any other PHP static variable, static properties may only be initialized using a literal or constant before PHP 5.6; expressions are not allowed. In PHP 5.6 and later, the same rules apply as const expressions: some limited expressions are possible, provided they can be evaluated at compile time.

So you cannot initialize a static variable with another variable. Replace $appdata['id'] with a constant string or remove the static attribute.

This is because all static declarations are resolved in compile-time, when the content of other variables is not known (see this other page of official doc).

비슷한 페이지

예제가있는 유사한 페이지

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................