<?php $array = array( 'store:key' => 1, 'user' => 'demo', 'store:foo' => 'bar', 'login' => true, ); if (PHP_VERSION_ID > 56000) { $return1 = array_filter($array, function ($e) { return strpos($e, 'store:') === 0; }, ARRAY_FILTER_USE_KEY); var_dump($return1); } $return2 = array_intersect_key($array, array_flip(array_filter(array_keys($array), function ($e) { return strpos($e, 'store:') === 0; }))); var_dump($return2);
You have javascript disabled. You will not be able to edit any code.