So I understand that references aren't pointers: http://php.net/manual/en/language.references.arent.php
Question is, is it possible to work with pointers in php?
Given the following example I would guess that's what we do when working with objects:
class Entity
{
public $attr;
}
class Filter
{
public function filter(Entity $entity)
{
$entity->attr = trim($entity->attr);
}
}
$entity = new Entity;
$entity->attr = ' foo ';
$filter = new Filter;
$filter->filter($entity);
echo $entity->attr; // > 'foo', no white space
Is the example above working with pointers behind the sceen or is it still swapping memory, as when working with references?
Edit
A different example:
Is the following:
class Entity
{
public $attr;
}
$entity = new Entity;
$entity->attr = 1;
$entity->attr = 2;
Something like this in C:
int* attr;
*attr = 1;
*attr = 2;
Entity $entitywont be a new object it will the same old one called as parameter..