Remove all elements from array that do not start with a certain string

Functional approach: $array = array_filter($array, function($key) { return strpos($key, ‘foo-‘) === 0; }, ARRAY_FILTER_USE_KEY); Procedural approach: $only_foo = array(); foreach ($array as $key => $value) { if (strpos($key, ‘foo-‘) === 0) { $only_foo[$key] = $value; } } Procedural approach using objects: $i = new ArrayIterator($array); $only_foo = array(); while ($i->valid()) { if (strpos($i->key(), ‘foo-‘) === … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)