so I have this class
class A{
public $something['aaa'] = 'soemthing';
}
but then it complains that there is syntax error....
how can I set class variables in PHP as an associative array?
That's strange. I don't think that's invalid syntax but it is throwing an error on my end. Maybe the parsre just isn't equipped to handle an property being initialized in that way. When I tried the following equivalent initialization it seemed to work just fine:
<?php
class A {
public $something = array("aaa" => "something");
}
?>