How to use if statement in an array? [closed]

Try this Omer

$fields =  array(
    'author' => '<div class="form-group"><input class="form-control" id="author" name="author" type="text" placeholder="Name '.( $req ? '*' : '' ) .'" value="' . esc_attr( $commenter['comment_author'] ) . '" ' . $aria_req . ' /></div>',
    'email'  => '<div class="form-group"><input class="form-control" id="email" name="email" type="text" placeholder="E-mail '.( $req ? '*' : '' ) .'" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></div>',
);

if($showURL == 1) {
    $fields['url'] = '<div class="form-group"><input class="form-control" id="url" name="url" type="text" placeholder="Website '.( $req ? '*' : '' ) .'" value="' . esc_attr(  $commenter['comment_author_url'] ) . '" size="30"' . $aria_req . ' /></div>';
}