如何在命名数组的键中删除模式并在PHP中返回它

Sample array:

array( 'keyword-one' => 'value', 'keyword-two' => 'value' );

What can I do so I get returned an array with keyword- omitted from the key so:

array( 'one' => 'value', 'two' => 'value' );

Use str_replace() to replace in the keys from array_keys() and combine with the values using array_combine():

$array = array_combine(str_replace('keyword-', '', array_keys($array)), $array);

For more complex patterns use preg_replace().