I need to figure out a way to partial match a string to a sub key in my PHP array.
example:
string = howdy-doody show as you can see there is a - dash and a space between the words. In my PHP array the sub key might be howdy doody show with no dashes or it might be howdy doody-show with the dash between a different word in the string.
How can I find the sub key in the array with the string given?
sample array
$pages = array(
'Administrator' => array(
'network-administrator' => array('title' => 'Network '.$li_1, 'description' => 'Network '.$li_1.' '.$temp_content, 'post' => '<p>Network '.$li_1.' '.$temp_content.'.</p>'),
'database administrator' => array('title' => 'Database '.$li_1, 'description' => 'Database '.$li_1.' '.$temp_content, 'post' => '<p>Database '.$li_1.' '.$temp_content.'.</p>'),
),
'Analyst' => array(
'business systems analyst' => array('title' => 'Business Systems '.$li_2, 'description' => 'Business Systems '.$li_2.' '.$temp_content, 'post' => '<p>Business Systems '.$li_2.' '.$temp_content.'.</p>'),
'data-analyst' => array('title' => 'Data '.$li_2, 'description' => 'Data '.$li_2.' '.$temp_content, 'post' => '<p>Data '.$li_2.' '.$temp_content.'.</p>'),
),
);
sample string
network administrator
sample variable to locate the array value
$content = $pages['Administrator']['network administrator'];
with the above variable it won't find the sub key in the array because the sub key uses a - dash like this network-administrator.
So how would I get the array value including the original subkey and returns its contents using the string that has the space instead of dash like so, network administrator?
Much appreciated for help!
.in place of the spaces/funny characters, or strip the funny characters from the array keys.