Code after a return statement in a PHP function

Viewed 8616

I'm working with/on an extremely antiquated site that I wouldn't put my name to. There seems to a re-occuring pattern in the existing code, along the lines of:

function foo() {
    $a = 'a';
    $b = 'b';

    return;

    $c = 'c';
    $d = 'd';
}

I'm very relunctant to delete existing code from a function that I didn't write, and everything is working as is. But I would like to know why?

Everything I ever learnt (with the exception of a goto line call) tells me that the code following the return statement is useless. Is it? Why would the previous programmer do this?

3 Answers
Related