Home > php教程 > PHP源码 > body text

array_file_keys:使用指定的键和值填充数组

PHP中文网
Release: 2016-05-23 16:40:02
Original
1239 people have browsed it

array_file_keys(array $keys,$values)
使用$keys 作为键值,$values 作为值

$arr_keys = ['aa','bb'];
$values = ['11','22',33];

$arr = array_fill_keys($arr_keys,$values);

echo '';
print_r($arr);

result:
Array
(
    [aa] => Array
        (
            [0] => 11
            [1] => 22
            [2] => 33
        )

    [bb] => Array
        (
            [0] => 11
            [1] => 22
            [2] => 33
        )

)		            		        	
			
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template