Skip to content

Instantly share code, notes, and snippets.

@Dinir
Created November 16, 2017 05:39
Show Gist options
  • Save Dinir/40fe4dfb48cc1655a6b9a55d5fc145f7 to your computer and use it in GitHub Desktop.
Save Dinir/40fe4dfb48cc1655a6b9a55d5fc145f7 to your computer and use it in GitHub Desktop.
making an array with keys occasionally having same values.
<?php
$type = array_merge(
array_fill_keys([
'css',
'css2'
], 'css'),
array_fill_keys([
'prejs',
'prejs2',
'js',
'js2'
], 'js')
);
/*
array (
'css' => 'css',
'css2' => 'css',
'prejs' => 'js',
'prejs2' => 'js',
'js' => 'js',
'js2' => 'js',
)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment