[PHP] fread problem

2003-03-02 Thread Paul Cohen
Hello all,

I am trying to read a php file to a varible and then print that variable.
Unfortunately, my php file is not being parsed by the fread function and I
can't figure out why.

Here is the code in my file and was taken directly from the manual:

$filename = test.php;
$handle = fopen ($filename, r);
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
echo $contents;

Here is test.php 

?PHP
echo Hello World;
?

 END test.php


When I run this, I get a blank page with my php code as my HTML source code.
Not good.

Finally, if you respond to this, please copy me directly as I get the
mailing list as a digest.

Thx,

Paul




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Delete Files on Server with PHP

2001-08-30 Thread Paul Cohen

Thanks Jason,

I was using a hard copy manual and couldn't find it in the file functions. 

Paul

-Original Message-
From: Jason Brooke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:27 AM
To: Paul Cohen; [EMAIL PROTECTED]
Subject: Re: [PHP] Delete Files on Server with PHP


 How can I send a command to remove it from the server within PHP?

 Thanks,

 Paul

You go to the online manual, browse to the Filesystem Functions section and
look up a function that removes files
http://www.php.net/manual/en/ref.filesystem.php

jason



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] String to Variable converstion

2001-01-17 Thread Paul Cohen

Hello all,

I am trying to build an IRR calculator using PHP.  The number of cash flow
streams I will have at any time will vary, so I am using a loop to build the
formula.  Then I am iterating to solve the equation and output the solution.

As most of you know, I am solving the following for r:

0=SUM SERIES(CF(i)/{(1+r)^n))

I can build my formula sucessfully with the following;

$form="";
while ($row=mysql_fetch_array($result)){
$form.="$CF/pow((1+'$r'),$N)";
}

But it recognizes $form as a string, so when I put it in my "solution for r"
loop:

for($r=-1.00; $r=1.00; $r=$r+.0001){
if($form-.001  $form  .001){
$IRR=round($r*100, 2);
}
}
echo "$IRR%br";


BTW, I have also tried building the $form as a variable, but since I don't
have a value for $r it just puts in zero and sets $form equal to the right
side of the equation. Therfore, instead of inserting a formula into my
"solution for r" loop, it inserts a constant for $form.

I think my solution is to build the formula as a string and then insert it
into my "solution for r" loop, convert it back to a real formula and then
iterate for the solution.  Is this possible?  If not, any suggestions?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]