I have a variable property set default value array, it works in my php 5.6 localhost but not working when i upload to server with php 7.1 , can anyone tell me why?
class foo {
var $bar = array();
function baz($data) {
$this->bar['data'] = $data; <---- works in php 5.6, not working in php 7.1
}
}
in php 7.1, I have to update variable property in construct
function __construct(){
$this->bar = array();
}