Find a string in array key with regex
<p><strong><em>Hello,</em></strong> </p>

<p><strong>Question 1 :</strong></p>

<p><strong><em>i need to a translate ( close meaning ) function like this,</em></strong> </p>

<pre><code>$translated_array = array(
    "(.*) Car(.*)" =&gt; "is_a_Araba", // "Araba" mean car in english. İts mean this ( in regex ) string mean car.
    "(.*) Apple(.*)" =&gt; "is_a_Elma" // "Elma" mean apple in english. İts mean this ( in regex ) string mean apple.
);
</code></pre>

<p><strong><em>İ have a string, like this :</em></strong></p>

<blockquote>
  <p>"1. Apple, it is awesome."</p>
</blockquote>

<p><strong><em>İ need if i call function like this;</em></strong></p>

<pre><code>function_name("1. Apple, it is awesome.", $translated_array) 
this return : "is_a_Elma".

function_name("1. Car, it is awesome.", $translated_array)
this return : "is_a_Araba".
</code></pre>

<p><strong>Question 2 :</strong></p>

<pre><code>$translated_array = array(
    "Car name: (.*), (.*) offers." =&gt; "This car name is $1, have $2 offers."
);
</code></pre>

<p>İn function : </p>

<pre><code>function_name("Car name: Bugatti, 5 offers.", $translated_array)
this return : "This car name is Bugatti, have 5 offers.".
</code></pre>

<p><strong>My tryouts</strong></p>

<p><strong>İ know this is a solution for my question but i need faster than this function. Like array_regex("Car name: Bugatti, 5 offers.", $translated_array) ( is example )</strong></p>

<p>So, i need to dont loop all values for a string. ( have 1000 + translated value. )</p>

<pre><code>    foreach($translated_array as $key =&gt; $value):
        if(preg_match('/'.$key.'/',$mystring)): return $value; break; endif;
        continue;
    endforeach;
</code></pre>