Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP array_fill_keys() Function
#1
It fills an array with the value of the value parameter, using the values of the keys array as keys.
The function array_fill() is used to assign or fill mixed values to an array by declaring suitable number of elements in the array. Whereas the function array_fill_keys() is used to fill mixed values to an array corresponding to the key values.

Parameter Description
keys Required. Array of values that will be used as keys
value Required. Specifies the value to use for filling the array



Syntax

Code:
array_fill_keys(keys,value);
[size=undefined][size=undefined]
Example[/size]
[/size]

Code:
$keys=array("a","b","c","d");
$array=array_fill_keys($keys,"Prince");
print_r($array);
[size=undefined][size=undefined]
Output[/size]
[/size]

Code:
Array ( [a] => Prince [b] => Prince [c] => Prince [d] => Prince )
To Purchase Credit Click here , For how to make money on Sologet forum Click here 

HIRE ME FOR WEBSITE DESIGNING US THE PM BUTTON TO SEND ME MESSAGE

There is love in sharing
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to Stop Sending E-Mail Spam using PHP mail function Kingsolomon 1 368 11-12-2018, 04:38 PM
Last Post: Solomon
  Multiple file upload in php Kingsolomon 1 332 11-08-2018, 03:01 PM
Last Post: Solomon
  How to limit text length in php and provide 'Read more' link Kingsolomon 0 379 10-31-2018, 02:08 PM
Last Post: Kingsolomon
  How to read more / hide text using Jquery and PHP Kingsolomon 0 314 10-31-2018, 02:06 PM
Last Post: Kingsolomon
  Download simple HTML email templates Kingsolomon 0 355 10-31-2018, 02:05 PM
Last Post: Kingsolomon

Forum Jump:


Users browsing this thread:
1 Guest(s)

PHP array_fill_keys() Function00