/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php class Set { protected $_storage_array; function __constructor() { } function add($value) { $this->_storage_array[$value] = $value; } function hasValue($value) { } function toArray() { } } $data = new Set; $data->add("Sarah"); $data->add("Jamie"); $data->add("Phil"); $data->add("Jamie"); print("Has Value Jamie? " . ($data->hasValue("Jamie") ? 'true' : 'false')) . PHP_EOL; /* Returns the following: Has Value Jamie? true Array ( [0] => Sarah [1] => Jamie [2] => Phil ) */ ?>