function splitColors($spl) { $expl = explode("^", $spl); $alldt = array(); if (count($expl) != 1) { $ind = 0; foreach ($expl as $key => $value) { if ($value != "") { $number = $value[0]; $replaced = str_replace($number, "", $value); if ($replaced != "") { $alldt[$ind]["text"] = $replaced; if ($this->hasColor($number)) { $alldt[$ind]["color"] = $number; $c = new color($number); $alldt[$ind]["hex"] = $c->getHex(); } else { $default = 1; $alldt[$ind]["color"] = $default; $c = new color($default); $alldt[$ind]["hex"] = $c->getHex(); } $ind++; } } } return $alldt; } else { return $spl; } }