php - Creating an array within a method -
i have:
class business relationship { private function something() { # trying set array here } }
but, keeps giving me error when utilize either of these. googled how create array within class, no avail.
private array options = ['cost' => 20]; array options = ['cost' => 20];
how done? thanks.
you seem missing of fundamentals of php. need refactor code follows:
class business relationship { private $options; private function something() { $options = array(); $options['cost'] = 20; $this->options = $options; } }
php arrays class
No comments:
Post a Comment