How do I store get_sidebar in a varaible? [duplicate]

get_sidebar() just includes a template, so its as dynamic as the string you pass to it. If you want to capture output and store it all as a variable, use output buffering native to PHP.