$my_array = array( 'one 1' => '1', 'two 2' => '2' );
$keys = str_replace( ' ', '', array_keys( $my_array ) );
$results = array_combine( $keys, array_values( $my_array ) );
public function fixArrayKey(&$arr): array
{
$arr = array_combine(
array_map(
static function ($str) {
return str_replace(" ", "", $str);
},
array_keys($arr)
),
array_values($arr)
);
return $arr;
}
Code Example |
---|
Php :: php catch exception |
Php :: push collection php |
Php :: get page thumbnail id wordpress |
Php :: laravel pagination keep query string |
Php :: Merge Two Collection or Array |
Php :: get domain url with https in laravel |
Php :: php server function |
Php :: take 10 skip 10 laravel |
Php :: laravel route target class not found |
Php :: updateorcreate laravel |
Php :: php pdo postegresql connection |
Php :: custom laravel auth |
Php :: php time |
Php :: php echo new line terminal |
Php :: laravel make model all with resources api |
Php :: js unserialize |
Php :: apiresource laravel |
Php :: tableau aléatoire php |
Php :: in_array |
Php :: php intval |
Php :: php trim quotes |
Php :: laravel add user |
Php :: laravel collection isempty |
Php :: php get option value |
Php :: upload multiple files in codeigniter |
Php :: call to a member function setcookie() on null laravel middleware |
Php :: laravel 9 Route::controller |
Php :: php example |
Php :: laravel observer |
Php :: wpdb get last query |