Funny code piece 1

A bit of things that i found funny.
We have method’s param with empty array default value and at first look we expect array here, but in fact it is can be a string with delimiter that we try transform to the array.

function SetHeader($Harray = [], $side = '', $write = false)
{
	$oddhtml = '';
	$evenhtml = '';
	if (is_string($Harray)) {
		if (strlen($Harray) === 0) {
			$oddhtml = '';
			$evenhtml = '';
		} elseif (strpos($Harray, '|') !== false) {
			$hdet = explode('|', $Harray);

I sure it is a lot of reasons for such code, backward compatibility obviously, but it still funny. Especially when you work a lot with legacy code and try improve that and when you show this as a joke some familiar developer and he answer: “Whats wrong? I do much more worst things in my projects!” :D.