Create custom post type with parameters

if you are not taking care about backward compatibility (works only when run under PHP 5.3 and later), you can employ the anonymous function:

add_action( 'init', function() {
    $pluralName="PluralName";
    $singularName="SingularName";
    custom_poster( $pluralName, $singularName );
    } 
);

Or closure

$singularName="Singular Name";
$pluralName="Plural Name";
add_action( 'init', function() use ($singularName, $pluralName) {
   custom_poster( $pluralName, $singularName );
} );