Inventive Structual Redundancy

An array based simple structure that has a single flaw, it’s redundant…


<?php
    final 
class FF {
    
private $data = array();
    
public function __construct() {
    }

    public function add($object) {
        
$temp = new self;
        
$temp->push($object);
        
$this->push($temp);
    }

    private function push($value) {
        
$selfcount count($this->data);
        
$this->data[] = $value;
    }
}

?>

Why did I post this? Was going through a topic of designing custom structure (which is dynamic, and can grow as large as needed) with someone, when this came up. But in the end, you can just push objects on to an array, without the OOPness

Leave a Reply