Simple Page Slug Array

I’m working on a custom function that will generate a link to a simple page if a specific search term is used. Right now I have a lot of statements like “if $search=’nineteenfifty’ then $slug=’1950’”. These statements are then followed by “if isset($slug) then link to simple page with $slug.” Currently whenever a new simple page is added, a new line has to be added to this function

I’m trying to have this happen automatically. All of the search terms that we are using and slugs are standardized, and I’ve figured out a way to convert these search strings into their numeric equivalent without having to do it one by one. However, I now need to figure out if the numeric equivalent is also a simple page slug. My thought would be to get an array of all the simple page slugs, and then compare my $slug value to that array.
I figure it will be something like:

while (loop_simple_pages()):
$simpleslug=array(simple_page('slug'));
endwhile;
if (in_array($slug, $simpleslug)) {
    then provide link to simple page
}

However, I have no idea how to actually accomplish this. How would I set the simple page slugs in an array? And would the in_array function allow me to see if my slug was a simple page slug?

Since I assume you'll only be dealing with one search term in each request, it's probably easier to just search directly for the corresponding numeric slug:

$db = get_db();
$page = $db->getTable('SimplePagesPage')->findBy(array('slug' => $numericSlug));
if ($page) {
    // There's a page with this slug, provide link
}

Awesome thanks!