Skip to content

Instantly share code, notes, and snippets.

@julianwachholz
Last active December 16, 2015 01:09
Show Gist options
  • Save julianwachholz/5352862 to your computer and use it in GitHub Desktop.
Save julianwachholz/5352862 to your computer and use it in GitHub Desktop.
Mind you, most of this does absolutely nothing or could be rewritten in two lines.
<?php
/**
* Explodes an XPath into an Array / only 2 Levels
* @param array $xpath
* @param boolean $utf8Encode
* @return array
*/
private function titleExploder($xpath, $utf8Encode = TRUE) {
$exTitle = explode('/', $xpath);
if ($utf8Encode) {
foreach ($exTitle as $k => &$v) {
$v = utf8_encode($v);
}
}
if (count($exTitle) > 1) {
// voodoo magic
return array(array_shift($exTitle)) + array(0, implode(' / ', $exTitle));
}
return $exTitle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment