Search the blog

This function takes an array and converts it to a string using a specifed separator value.

function arrayConcat($array, $separator) {

    $string = '';

    $length = count($array);

    for ($counter = 0; $counter < $length; $counter ++) {

        $string .= $array[$counter];

        if ($counter < ($length - 1)) {

            $string .= $separator;

        }

    }

    return $string;

}
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.