In my opinion; if you're gonna repeat the exact same piece of code more than twice.. put it into a function..
Code:
function getStuff() {
$string = array();
$string['a'] = $a stuff;
$string['b'] = $b stuff;
$string['c'] = $c stuff;
return $string;
}
if(something)
{
$str = getStuff();
do something with $str['a'] $str['b'] and $str['c']
}
else
{
do something else
}
if(another thing)
{
do something
}
else
{
$str = getStuff();
do something with $str['a'] $str['b'] and $str['c']
}
if(one last thing)
{
$str = getStuff();
do something with $str['a'] $str['b'] and $str['c']
}
else
{
do something else
}
"Problem" solved
__________________