<?php
class Test {
protected $variable = array('test' => 'hello world!', 'another_test' => 'hello world?');
public function __construct($var) {
var_dump($this->variable); // this is the whole array you defined initially
$this->variable = $var; // here the $var ('testing contents') overwrites `variable`
var_dump($var); // 'testing contents'
var_dum($this->variable); // $this->variable is now the same as the argument passed in
}
}
new Test('testing contents');
array(2) {
["test"]=>
string(12) "hello world!"
["another_test"]=>
string(12) "hello world?"
}
string(16) "testing contents"
Fatal error: Call to undefined function var_dum() in /in/9mS8P on line 12
Process exited with code 255.