Site icon Hip-Hop Website Design and Development

Variable world scope

I am attempting to create just a few customized publish sorts, and as an alternative of hard-coding their names I simply need to outline them as a globally scoped variable.
I assumed I understood the scope however apparently not. The code beneath ends in an error of Undefined variable:

$filmLabel = "Films";
$showLabel = "Shows";
operate CreatePostTypes() {
    register_post_type( $filmLabel, GenerateFilmType($filmLabel));
    register_post_type( $showLabel, GenerateFilmType($showLabel));
}
add_action( 'init', 'CreatePostTypes' );

I’ve tried utilizing $GLOBAL as effectively, with the identical end result.
Can anybody spot what’s flawed?