خرید بک لینک

Vote count: 0

I have a foreach loop to format an object like this :

foreach ($data as $index => $item) {
    $temp           = array_merge($columns['columns'], $temp);
    $data->$index   = (object)$temp;
}

basically I am modifying the object and I also can do it in this way

foreach ($data as &$item) {
    $temp = array_merge($columns['columns'], $temp);
    $item = (object)$temp;
}

Which is the best practice for modifying the object ?

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 12 فروردين 1395 ساعت: 13:01

صفحه بندی