Wordpress中的数组?

I'm trying to understand the array in wordpress. Here is my original code in the header.php.

<?php

    if( is_page( array('salon-and-spa-pap', 'tocante-nos', 'testimonio', 'tuma-contacto-cu-nos', 'galeria', 'tratamentonan-di-masahe', 'tratamentonan-spa-di-curpa', 'servicionan-di-boda', 'tratamentonan-spa-di-cara', 'wowo-lip-nek', 'cuido-di-man', 'tratamento-di-huna', 'tratamento-di-huna-di-pia', 'cuido-di-pia', 'salon-p', 'spa-etiquette-pap', 'wax-p', 'reserva-un-tratamento')) ) {
        wp_nav_menu(array( 'theme_location' => 'menu_top_pap' ) );
    } else {
        wp_nav_menu(array( 'theme_location' => 'secondary-menu' ) );
    }

?>

Won't it be easier if I do it like that?

<?php
$papPages = array('salon-and-spa-pap', 'tocante-nos', 'testimonio', 'tuma-contacto-cu-nos', 'galeria', 'tratamentonan-di-masahe', 'tratamentonan-spa-di-curpa', 'servicionan-di-boda', 'tratamentonan-spa-di-cara', 'wowo-lip-nek', 'cuido-di-man', 'tratamento-di-huna', 'tratamento-di-huna-di-pia', 'cuido-di-pia', 'salon-p', 'spa-etiquette-pap', 'wax-p', 'reserva-un-tratamento');
    if( is_page( $papPages )) ) {
        wp_nav_menu(array( 'theme_location' => 'menu_top_pap' ) );
    } else {
        wp_nav_menu(array( 'theme_location' => 'secondary-menu' ) );
    }

?>

So that I can repeat this code in other areas of header.php like this?

<?php
        if( is_page( $papPages )) ) {
            wp_nav_menu(array( 'theme_location' => 'menu_top_pap' ) );
        } else {
            wp_nav_menu(array( 'theme_location' => 'secondary-menu' ) );
        }

?>

Or should I have added the $papPages to the functions.php?