eval.in

Paste #110345

PHP — PHP 5.4.6, pasted 1 year ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<?php
$arr1 = array("Strongly Agree" => 100);
$arr2 = array(
	   "Strongly Agree",
	   "Agree",
	   "Neither Agree or Disagree",
	   "Strongly Disagree",
	);
$arr2 = array_merge(array_fill_keys($arr2, 0), $arr1);
print_r($arr2);

Program Output

Array
(
    [Strongly Agree] => 100
    [Agree] => 0
    [Neither Agree or Disagree] => 0
    [Strongly Disagree] => 0
)

OK (0.012 sec real, 0.011 sec wall, 13 MB, 80 syscalls)

Fork