Vim & PHP: extract visual selection to variable

Simple snippet for extracting the visual selection in Vim to a PHP variable.

vnoremap <leader>e :call PHPExtractVariable()<cr>

function! PHPExtractVariable()
    let l:name = input("Name of new variable: $")
    normal! gvx
    execute "normal! i$".l:name
    execute "normal! O$".l:name." = "
    normal! pa;
endfunction