You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can't access a class field through a value in a variable.
There can be two cases in php:
class Test {
privatestring$name;
...
}
main();
functionmain() {
$cls = newTestClass();
$cls->getName("name"); // First case$cls->getName("test"); // Second case
}
In the first case, we refer to the variable of our class. In most cases, we will not be able to calculate this name in the compile-time. (Cannot be supported in kphp)
In the second case, we create new field of our class. We cannot add new class fields in runtime. (Cannot be supported in kphp)
P.S. Therefore, I think it's worth closing this issue.
Output to KPHP:
Output to PHP:
The text was updated successfully, but these errors were encountered: