我\xe2\x80\x99m 在 PHP 8.2\xe2\x80\x99s 动态属性弃用方面遇到了困难。I\xe2\x80\x99m 在这里寻找与 PHP 9.0 兼容的永久解决方案,因此添加属性#[AllowDynamicProperties]是对我来说不是一个解决方案。
这里\xe2\x80\x99是我的问题。例如,我曾经有以下课程:
\nclass planet {\n function __construct($id, $a, $m, $i, $e, $\xcf\x80) {\n $this->a = $a;\n $this->e = $e;\n $this->i = $i;\n $this->id = $id;\n $this->m = $m;\n $this->n = .9856076686 / ($a * sqrt($a));\n $this->\xcf\x80 = $\xcf\x80;\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n然后我将使用以下数组创建每个行星:
\n$pl = [\n new planet("Mercury", .38709831, 3.3011e23, 7.004986, .20563, 77.456119),\n new planet("Venus", .723332982, 4.8675e24, 3.394662, .006772, 131.563703)\n];\nRun Code Online (Sandbox Code Playgroud)\n等等。
\n如果我现在尝试这个,我当然会收到现在著名的通知:\nDeprecated: Creation of …