This is because when you execute function a
it declares function b. Executing it again it re-declares it. You can fix this by using function_exists
function.
function a(){
if(!function_exists('b')){
function b(){}
}
}
But what I suggest is, you should declare the function outside. NOT inside.