true answers of upwork | php5
What is the best way to change the key without changing the value of a PHP array element?
Answers:
• $arr[$newkey] = $oldkey; unset($arr[$oldkey]);
• $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);
• $newkey = $arr[$oldkey]; unset($arr[$oldkey]);
• $arr[$newkey] = $oldkey.GetValue(); unset($arr[$oldkey]);
No comments:
Post a Comment