How do I make it so every array is set to false .. I don't want to do it like this:
$a = array('clue1' => 'false', 'clue2' => 'false', 'clue3' => 'false');
because that will take long time. Is there easier way?
How do I make it so every array is set to false .. I don't want to do it like this:
$a = array('clue1' => 'false', 'clue2' => 'false', 'clue3' => 'false');
because that will take long time. Is there easier way?
http://www.php.net/manual/en/function.array-fill.php array_fill may be of use.
I think he is looking for array_fill_keys
$keys = array("clue1", "clue2", "clue3", "clue4");
$a = array_fill_keys($keys, "false");
print_r($a);
Of course you could use a for statement to setup the clue part too.
for ($x=1; $x < 5; $x++) {
$keys[] = "clue".$x;
}
//$keys = array("clue1", "clue2", "clue3", "clue4");
$a = array_fill_keys($keys, "false");
print_r($a);