I have this array with certain brand_ids, within these brands I have an array of dates in which a sale occured but these are based on the products in sale so they may appear multiple times on the same brand_id; This is my array: The code to generate this : $saleDays is a 2D array of every sunday untill a
Tag: array-unique
Merge PHP arrays to create named keys and unique values
I have an object which contains 3 arrays, any of which may be empty, it is feasible all three can be empty, so I need to handle that requirement too. Here’s an example of the object: I need to merge these 3 arrays into a single array with unique values, using the existing keys so that the output contains a
What is better to use: in_array or array_unique?
I am in doubt what to use: foreach(){ // ….. if(!in_array($view, $this->_views[$condition])) array_push($this->_views[$condition], $view); // …. } OR foreach(){ /…