I try to remove a prefix in array keys and every attempt is failing. What I want to achieve is to:
Having: Array ( [attr_Size] => 3 [attr_Colour] => 7 )
To Get: Array ( [Size] => 3 [Colour] => 7 )
Your help will be much appreciated…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One of the ways To Get:
Array ( [Size] => 3 [Colour] => 7 )From yourHaving: Array ( [attr_Size] => 3 [attr_Colour] => 7 )If you think there’ll be multiple underscores in keys just replace first line inside foreach with
list($dummy, $newkey) = explode('attr_', $key);