On Fri, 2003-06-20 at 17:07, Kyle Babich wrote:
> I have a file, current.txt, that at the start has only the digit 1 in it. Here is
> my code:
Hi there,
> $current = readfile('setupData/current.txt');
This will cause $current to contain the number of bytes read from the
file, not the contents of the file.
http://www.php.net/readfile
Instead, use fopen()/fread(); or file()/implode(); or if you have PHP
4.3.x or newer, use file_get_contents().
http://www.php.net/file_get_contents
http://www.php.net/fopen
http://www.php.net/fread
http://www.php.net/file
http://www.php.net/implode
> foreach ($HTTP_POST_VARS as $index => $value) {
> $index = $HTTP_POST_VARS['$index'];
> }
This will do two things you probably don't want: first, it will
repeatedly assign values to $index, overwriting it on each iteration;
and, it will always use the same value to do so, since
$HTTP_POST_VARS['$index'] has the single-quotes, which prevents PHP
from interpreting the contents of $index--so it's literally using the
string value '$index' instead of the value of the $index variable. You
probably want variable variables:
$$index = $HTTP_POST_VARS[$index];
...although even easier would be:
$$index = $value;
http://www.php.net/manual/en/language.variables.variable.php
[snip]
> Thanks,
> --
> Kyle
Hope this helps,
Torben
--
Torben Wilson <[EMAIL PROTECTED]> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php