Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php constant expression contains invalid operations


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).
Comment

PREVIOUS NEXT
Code Example
Php :: php ascii to decimal 
Php :: PHP OOP - Abstract Classes 
Php :: default time of session in php 
Php :: laravel collection all 
Php :: laravel run function after forgot password 
Php :: php array_search 
Php :: check if a string contains a word 
Php :: laravel set middleware default 
Php :: laravel + join 2 eloquent queries 
Php :: laravel 9 requirements 
Php :: php .com 
Php :: inner pages not found yii 
Php :: php artisan migrate stuck 
Php :: wherenotnull laravel 
Php :: Check Data Load More Laravel Livewire 
Php :: google sheets to php equation 
Php :: laravel How do I chain multiple where and orWhere clause in laravel from an Array [duplicate] 
Php :: aravel cache store does not support tagging 
Php :: how to pass value in app.blade 
Php :: Array unpacking support for string-keyed arrays - PHP 8.1 
Php :: ob_start store variable in php 
Php :: 200usd to php 
Php :: update query not working no errors found php mysql 
Php :: PHP number_format — Format a number with grouped thousands 
Php :: php mysql remove by timestamp older than a month 
Php :: js data php 
Php :: polymorph laravel return order by 
Php :: requires ext-pcntl 
Php :: phpmailer 5 string attachment 
Php :: pusher in laravel array_merge(): Argument #2 is not an array 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =