I'm trying to return an Array of Strings in a function within my class
When I try to use a private static array it returns me the following error:
Fatal error: Constant expression contains invalid operations in /home/developer/projects/api/src/public/Sql.php on line 17
This is my Class
<?php
namespace App;
/**
* Class Sql
*
* @return (Array) (Strings)
*/
Class Sql {
private static $columns = (implode(",", array('product_id','model','viewed','ups','downs','location','price','quantity')));
public function getColumns() {
echo "<pre>";
print_r(self::$columns);
echo "</pre>";
exit();
}
}
Is there a problem in syntax or am I doing something I should not do?
What would be the right thing to do?