Combining my code
| From: | Scott Saraniero | Date: | Tue, 29 Jan 2002 20:16:23 +0000 |
| Subject: | Combining my code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-82600@lists.php.net to get a copy of this message | ||
Hi,
I've got two bits of code below that work fine, but I would like to combine
them if possible. The $check variable that is there is there now would
normally be passed from a form. Since the items in the '$Company = array()'
part would be passed into that section - how can this be done?
*****************************************
<?php
$check = array("Item1", "Item2", "Item3", "Item4",
"Item5",);
for ($i=0; $i<count($check); $i++) { print("\\\"$check[$i]\\\", ");
}
$fp = fopen("PR.inc", "w+");
fwrite($fp, " <?php\n\$Company = array(\"Item1\", \"Item2\",
\"Item3\",
\"Item4\", \"Item5\");\n?>");
fclose($fp);
?>
*****************************************
The end result would be for me to have
<?php $Company = array("Item1", "Item2", "Item3",
"Item4", "Item5"); ?>
written in the PR.inc file (for use as an include later).
Thanks,
Scott