PHP Array Improvement

Quick question, most likely for a veteran will be easy, or maybe im asking for too much.

i have this code for laravel in php, im not fan to do a foreach, is there a better way? i guess should be an existing function that replace my values of arr to the keys match on arr2, but i dont know

Its really important not to change the order.

$arr=  ['filters', 'repeat', 'via', 'type'];
$arr2= [
'filters' => 'text1',
'repeat' => 'text2',
'via' => 'text3',
'type' => 'text4',
];

foreach($arr as $k)
$res[]=$arr2[$k];

return $res;


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LhpNSB
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time