I have two arrays here that I have combined into a new array, as shown here:

$from = explode("-", $from);
$change = explode("-",$change);
$new_array = array_combine($from,$change);

I then tried reading it from a file and do string matches, trying to find out 
the "key" using the array_search of the individual array elements. I seem to 
have no such luck, even when I copied one of the elements after I do a 

Here is the code,

foreach ($lines2 as $line_num => $line2) { 
$style_line_num = $line_num+3;

      if(preg_match("/^style/",$line2)) {
            if(preg_match("/inkscape:label/",$lines2[$style_line_num])) {  
            $location = explode("=",$lines2[$style_line_num]);
            $location2 = substr($patient_location[1],1,-6);  
             if(in_array($location2, $from)) {                  
             $key= array_search($location2,$new_array); //Find out the position 
of the index in the array        
             echo "Key " . $key . "<br>";  //This only gives me a blank space 
after the word Key

         } //end preg_match inkscape           
   }  //If preg_match style

I looked at the example from 
http://php.net/manual/en/function.array-search.php, and looks like what I am 
trying to do here is possible, and yet, why am I not getting a proper key 

Thanks for your help.

Hotmail: Powerful Free email with security by Microsoft.

Reply via email to