Data objects and PhpStorm
I am currently testing the use of data objects.
Here is an example:
---------------------------------------
class data implements arrayaccess {
protected $firstname = null;
protected $lastname = null;
protected $street = null;
public function offsetSet($key, $value)
{
if(isset($key, $this)){
$this->$key = $value;
return true;
}
return false;
}
public function offsetGet($key)
{
if(!isset($this->$key) or empty($this->$key))
return false;
return $this->$key;
}
public function offsetUnset($key)
{
if(isset($this->$key)){
$this->$key = null;
return true;
}
return false;
}
public function offsetExists($key)
{
if(isset($this->$key) and !empty($this->$key)){
return true;
}
return false;
}
}
--------------------------------
The data I want to use the data properties.
I'm looking for a way that data using a button in the script to write.
$data = new data();
$data['firstname'] = 'Stephan';
$data['lastname'] = 'Krauss';
// Here i will insert $data['firstname'] with a simple button click
$foo['firstname'] =
Who can help with an idea?
Sincerely yours
Stephan
请先登录再写评论。